A text file called "Oscars.txt" is given to you. It includes the names of some actors with their respective Oscar wins, separated by 3 spaces. You should first define the function dict_maker(). This function will transform the text file into a dictionary (key=name, value=count) and send back this dictionary from its caller. The main() function should call the dict_maker() function to receive the dictionary. In this function, ask the user to add new key pairs to that dictionary as long as the user wants to continue. Then print the updated dictionary that includes new key pairs in it. Sample outputs are given below: What is the name of the actor/actress: Adrien Brody What is the Oscar count: 1 Would you like to continue (1/0): 1 What is the name of the actor/actress: Rami Malek What is the Oscar count: 1 Would you like to continue (1/0): 0 Below is the dictionary: (Katharine Hepburn': '4', 'Daniel Day-Lewis': '3', 'Meryl Streep': '3', 'Jack Nicholson': '3', 'Frances McDormand': '3', 'Walter Brennan': '3', 'Bette Davis': '3', 'Spencer Tracy': '2', 'Denzel Washington': '2', 'Marlon Brando': '2', 'Jack Lennon': '2', 'Cate Blanchett': '2', 'Adrien Brody': '1', 'Rami Malek': '1')

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

4

Subject: Dictionaries and Files
A text file called "Oscars.txt" is given to you. It includes the names of some actors with their
respective Oscar wins, separated by 3 spaces.
You should first define the function dict_maker(). This function will transform the text file into
a dictionary (key=name, value=count) and send back this dictionary from its caller.
The main() function should call the dict_maker() function to receive the dictionary. In this
function, ask the user to add new key pairs to that dictionary as long as the user wants to
continue. Then print the updated dictionary that includes new key pairs in it.
Sample outputs are given below:
What is the name of the actor/actress: Adrien Brody
What is the Oscar count: 1
Would you like to continue (1/0): 11
What is the name of the actor/actress: Rami Malek
What is the Oscar count: 1
Would you like to continue (1/0): 0
Below is the dictionary:
(Katharine Hepburn': '4', 'Daniel Day-Lewis': '3', 'Meryl Streep': '3, Jack
Nicholson': '3', 'Frances McDormand': '3', 'Walter Brennan': '3', 'Bette Davis':
'3', 'Spencer Tracy': '2', 'Denzel Washington': '2', 'Marlon Brando': '2', 'Jack
Lemmon': '2', 'Cate Blanchett': '2', 'Adrien Brody': '1', 'Rami Malek': '1')
Transcribed Image Text:Subject: Dictionaries and Files A text file called "Oscars.txt" is given to you. It includes the names of some actors with their respective Oscar wins, separated by 3 spaces. You should first define the function dict_maker(). This function will transform the text file into a dictionary (key=name, value=count) and send back this dictionary from its caller. The main() function should call the dict_maker() function to receive the dictionary. In this function, ask the user to add new key pairs to that dictionary as long as the user wants to continue. Then print the updated dictionary that includes new key pairs in it. Sample outputs are given below: What is the name of the actor/actress: Adrien Brody What is the Oscar count: 1 Would you like to continue (1/0): 11 What is the name of the actor/actress: Rami Malek What is the Oscar count: 1 Would you like to continue (1/0): 0 Below is the dictionary: (Katharine Hepburn': '4', 'Daniel Day-Lewis': '3', 'Meryl Streep': '3, Jack Nicholson': '3', 'Frances McDormand': '3', 'Walter Brennan': '3', 'Bette Davis': '3', 'Spencer Tracy': '2', 'Denzel Washington': '2', 'Marlon Brando': '2', 'Jack Lemmon': '2', 'Cate Blanchett': '2', 'Adrien Brody': '1', 'Rami Malek': '1')
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Lists
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education