In this program assignment, you will find a text file named WorldSeries.txt. This file contains a chronological list of the World Series' winning teams from 1903 through 2020. The first line in the file is the name of the team that won in 1903, and the last line is the name of the team that won in 2020. (Note the World Series was not played in 1904 and 1994. There are entries in the file indicating this.)
Write a program that reads this file and creates TWO dictionaries. The keys of the first dictionary are the names of the teams, and each key's associated value is the number of times the team has won the World Series. The keys of the second dictionary are the years, and each key's associated value is the name of the team that won that year.
Next display the top five teams that won the most of the times in a descending order. A sample looking could be as:
Top Five of World Series Champions: | |
Team Name | Winning Times |
New York Yankees | 27 |
St. Louis Cardinals | 11 |
Boston Red Sox | 8 |
New York Giants | 5 |
Pittsburgh Pirates | 5 |
The program should then prompt the user to enter a year in the range of 1903 through 2020. It should then display the name of the team that won the World Series that year, and the number of times that team has won the World Series. The program should allow a user to play multiple times. Remind user how to terminate/stop the program.