Unknown loop exercise:
Please code the following 2 programs:
1. This program asks for the score from each game that two teams play. They play 15 games. It asks the score of each team and prints the score. At the end, it prints the total wins for each team. (There are only two teams.) (I suggest you first code it to work without the total wins for each time. Compile and test just that, and then add in totalling the wins for each team.
A sample run would be:
What is the score for team 1 game 1? 15
What is the score for team 2 game 1? 20
Team 2 won.
What is the score for team 1 game 2? 30
What is the score for team 2 game 2? 30
The teams tied.
(repeat above for 15 games)
Team 1 won 5 times and Team 2 won 9 times.
2. Create a new program that asks for almost the same thing, but you don't know how many games were played. Before each score, you ask if they have another score to enter.
A sample run would be:
What is the score for team 1 game 1? 15
What is the score for team 2 game 1? 20
Team 2 won. Do you have another score to enter? Yes
What is the score for team 1 game 2? 30
What is the score for team 2 game 2? 30
The teams tied.
Do you have another score to enter? No
Team 1 won 0 games. Team 2 won 1 game.