Jan-29-2019, 11:33 PM
(This post was last modified: Jan-29-2019, 11:37 PM by ichabod801.)
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.
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.
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.