Python Forum
Help with arrays assignment
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with arrays assignment
#1
Good evening. I am new to coding and python this is my fourth week in class. The assignment was

Statistics on football games are often displayed as the number the points each team (home and visitor) scored in each of four quarters. Write a program to create an array for the home team scores and another array for the visiting team scores. The program should ask for the name of the home team and the visiting team. It should also ask for the number of points each team scores per quarter. Then, based on that input, it will create a text chart with the data and the total number of points for each team.
The program should look like this. Remember, anything after a “>” is user input. Also, don't worry if you can't get the number to line up nicely in columns.
Output:
Enter the home team's name? >Mountaineers Enter the visiting team's name? >Fighting Irish How many points did the Mountaineers score in quarter 1? >7 How many points did the Fighting Irish score in quarter 1? >7 How many points did the Mountaineers score in quarter 2? >10 How many points did the Fighting Irish score in quarter 2? >7 How many points did the Mountaineers score in quarter 3? >0 How many points did the Fighting Irish score in quarter 3? >14 How many points did the Mountaineers score in quarter 4? >21 How many points did the Fighting Irish score in quarter 4? >0 Total Statistics Quarter Mountaineers Fighting Irish 1 7 7 2 10 7 3 0 14 4 21 0 Total 38 28
I did the following code
team1 = [""]
team2 = [""]
team1[0] = input("Enter the home team's name?")
team2[0] = input("Enter the visiting team's name?")
team_1 = ["","","",""]
team_2 = ["","","",""]
team_1[0] = eval(input("How many points did the", team1 ,"score in quarter 1?"))
team_2[0] = eval(input("How many points did the", team2 ,"score in quarter 1?"))
team_1[1] = eval(input("How many points did the", team1 ,"score in quarter 2?"))
team_2[1] = eval(input("How many points did the", team2 ,"score in quarter 2?"))
team_1[2] = eval(input("How many points did the", team1 ,"score in quarter 3?"))
team_2[2] = eval(input("How many points did the", team2 ,"score in quarter 3?"))
team_1[3] = eval(input("How many points did the", team1 ,"score in quarter 4?"))
team_2[3] = eval(input("How many points did the", team2 ,"score in quarter 4?"))
print("Total Statistics")
I keep getting the following error: TypeError: input expected at most 1 arguments, got 3
I know its because its reading 3 arguments in my lines, however I can't figure out how to make it one argument and pull the team data. I tried googling some stuff but all those arguments were using numbers so I was kind of confused. I'd appreciate any help.
Reply


Messages In This Thread
Help with arrays assignment - by hyg71886 - Jan-29-2019, 11:33 PM
RE: Help with arrays assignment - by ichabod801 - Jan-29-2019, 11:41 PM
RE: Help with arrays assignment - by hyg71886 - Jan-29-2019, 11:58 PM
RE: Help with arrays assignment - by ichabod801 - Jan-30-2019, 02:06 AM
RE: Help with arrays assignment - by hyg71886 - Jan-30-2019, 02:27 AM
RE: Help with arrays assignment - by ichabod801 - Jan-30-2019, 02:27 AM
RE: Help with arrays assignment - by hyg71886 - Jan-30-2019, 02:36 AM
RE: Help with arrays assignment - by ichabod801 - Jan-30-2019, 02:52 AM
RE: Help with arrays assignment - by hyg71886 - Jan-30-2019, 02:59 AM
RE: Help with arrays assignment - by ichabod801 - Jan-30-2019, 03:03 AM
RE: Help with arrays assignment - by hyg71886 - Jan-30-2019, 03:22 AM
RE: Help with arrays assignment - by ichabod801 - Jan-30-2019, 03:28 AM
RE: Help with arrays assignment - by hyg71886 - Jan-30-2019, 03:43 AM
RE: Help with arrays assignment - by ichabod801 - Jan-30-2019, 04:07 AM
RE: Help with arrays assignment - by hyg71886 - Jan-30-2019, 04:10 AM
RE: Help with arrays assignment - by perfringo - Jan-30-2019, 09:36 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020