Fix any syntax errors
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Fix any syntax errors
#Lab 8 Dictionary and File I/O; source start file
import pickle
#Task #1: Define and Review Mainline Logic
def main():
print('Hello from main(); Lab 8 start file!!!')
#Task #2: Call Data Review Function
#view_winners_function()
#Task #3: Call Dictionary Function
#create_dictionary_function()
#Task #4: Call Serialization Function
#create_dictionary_serialization_function()
#Task #5: Call Application Function
user_application_function()
def user_application_function():
print('World Series Winner Application!!!\n')
input_year = int(input('What year do you want: '))
input_WS_data = open('ws_k_v_dictionary_pairs.dat')
world_series_dictionary_new = pickle.load(input_WS_data)
input_WS_data.close()
print(world_series_dictionary_new.get(input_year))
def create_dictionary_serialization_function():
#input
input_game_winners = open('WorldSeriesWinners.txt', 'r')
world_series_dictionary = {}
key_year = 1903
#Process
for line in input_game_winners:
world_series_dictionary[key_year] = line.rstrip()
key_year += 1
#Output
#for key in world_series_dictionary:
#print(key, world_series_dictionary[key])
#print('World Series Dictionary Data Type:',type(world_series_dictionary))
#print('World Series Dictionary Address:', hex(id(world_series_dictionary)))
output_file = open('ws_k_v_dictionary_pairs.dat','wb')
pickle.dump(world_series_dictionary, output_file)
output_file.close
input_WS_file = open('ws_k_v_dictionary_pairs.dat','rb')
world_series_dictionary02 = pickle.load(input_WS_file)
print(world_series_dictionary02)
input_WS_file.close()
input_game_winners.close()
#Task 3
def create_dictionary_function():
#input
input_game_winners = open('WorldSeriesWinners.txt', 'r')
world_series_dictionary = {}
key_year = 1903
#Process
for line in input_game_winners:
world_series_dictionary[key_year] = line.rstrip()
key_year += 1
#Output
for key in world_series_dictionary:
print(key, world_series_dictionary[key])
print('World Series Dictionary Data Type:', type(world_series_dictionary))
print('World Series Dictionary Address:', hex(id(world_series_dictionary)))
input_game_winners.close()
#Task #2: Define Data Review Function
def view_winners_function():
#input
input_game_winners = open('WorldSeriesWinners.txt', 'r')
#process
#Output
for line in input_game_winners:
print(line.rstrip())
#Task #4: Define Serializing an Object Function
#Task #5: Define Application Logic Function
#Call Mainline Logic
main()
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY