In: Computer Science
Homework 3 – World Series and Inpatient Payment System
This assignment has two parts: one that takes information from the web and one that takes it from a file. To select the type of information to gather, a menu will be used. Although the assignment does not require the use of functions, they can be useful.
***** This question uses Python Programming Language. The website can not be provided in the question, but the website entails every World Series since 1903, the year it was played, the team who won, the team who lost, and what the series score was. *****
MENU
The menu will have six choices.
WEB
The program will go to this website: On that page is a table showing
Gather all these statistics into one of these configurations: a single list, multiple lists, or a dictionary. Another method could be to store the information in one or more files. There is no requirement for having a certain method for storing this information. It is your choice.
See the MENU section for the required information to gather.
FILE
Open it to find this information:
The results of the Charges or the Referrals will be written to a file.
Both the Web and File sections can go in one module. You can do separate modules, if you wish.
See the attached rubric for requirements.
Rubric
Homework 3 - World Series and Inpatient Payment |
Points |
Is there a main function? |
|
Yes (5) |
5 |
Is the code inside main? |
|
Yes (5) |
5 |
Is there a menu? |
|
Yes (5) |
5 |
Does the menu work? |
|
Yes (5) |
5 |
WEB |
|
Did you get the title? |
|
Yes (5) |
5 |
Did you get the years where there were shutouts? |
|
Yes (10) |
10 |
Did you do one of the options? Winner / Loser or |
|
Yes (10) |
10 |
FILE |
|
Did you get the number of records in South Dakota? |
|
Yes (10) |
10 |
Did you do one of the options? Average Charges / |
|
Yes (10) |
10 |
Did you write the charges / referrals to a file? |
|
Yes (10) |
10 |
Did you use variables? |
|
Yes (15) |
15 |
Is standard variable naming used? |
|
Yes (5) |
5 |
Is the standard function naming used? |
|
Yes (5) |
5 |
Are all errors handled? |
|
Yes (30) max of 3 @ 10 pts. each |
30 |
Are comments used? |
|
Header (5) |
5 |
Body (10) |
10 |
Is the code written neatly? |
|
Yes (5) |
5 |
Are the results displayed neatly? |
|
Yes (5) |
5 |
Miscellaneous: anything not in the |
10 |
ANSWER:-
given that,
def menu():
'''This is the main menu'''
while True:
print("---------- MENU ----------")
print("1. Get title of the webpage")
print("2. Number of shoutout")
print("3. Exit")
print("4. Submenu 1")
print("5. Records from south dakota")
print("6. submenu 2")
option = int(input("Enter your option : "))
if option <1 or option >6:
print("Invalid option, Enter again")
continue
break
return option
def submenu1():
'''This is the submenu 1'''
while True:
print("---------- SUB MENU 1 ----------")
print("1. Find the winner and looser of the year")
print("2. Find the numebr of times the team wins")
option = int(input("Enter your option : "))
if option <1 or option >2:
print("Invalid option, Enter again")
continue
break
return option
def submenu2():
'''This is the submenu 2'''
while True:
print("---------- SUB MENU 1 ----------")
print("1. Highest of average covered")
print("2. Referals from ca")
option = int(input("Enter your option : "))
if option <1 or option >2:
print("Invalid option, Enter again")
continue
break
return option
def main():
while True:
option = menu()
if option == 3:
break # exit condition
if option == 1:
# Get title of the webpage
# TODO : Implement the code to rad from the webpage and display the
title
pass
elif option == 2:
#TODO : Number of shoutout
pass
elif option == 4:
option = submenu()
if option == 1:
# TODO :Find the winner and looser of the year
pass
else:
# TODO : Find the numebr of times the team wins
pass
elif option == 5:
# TODO :Records from south dakota
pass
else :
# TODO : submenu 2
option = submenu2()
if option == 1:
# TODO :Highest of average covered
pass
else:
# TODO : Referals from ca
pass
main()