Popular Names The 2 data files: boynames.txt and girlnames.txt each contain a list of the 1000 most popular names for boys and girls in the U.S. for the year 2021 as compiled by the Social Security Administration. These are blank-delimited files where the names are listed in order of popularity (the most popular name is listed first and the 1000th most popular name listed last). Each line consists of the name followed by a blank space and then the number of registered births using that name in the year. Write a program that reads both the girl's and boy's files into memory using a dictionary. The key should be the name and value should be a user defined object which is the count and rank of the name. Allow the user to input a name, the program should find the name (regardless of user's input letter case - i.e. upper or lower case) in the dictionary and print out the rank and the number of names. If the name isn't a key in the dictionary, then the program should indicate this. The program continues until "-1" is entered, and should say Exiting program. when this happens. The first two lines, I need to open text files boynames and girlnames Thank you so much and have a great day

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

Python Code please

Popular Names

The 2 data files: boynames.txt and girlnames.txt each contain a list of the 1000 most popular names for boys and girls in the U.S. for the year 2021 as compiled by the Social Security Administration. These are blank-delimited files where the names are listed in order of popularity (the most popular name is listed first and the 1000th most popular name listed last). Each line consists of the name followed by a blank space and then the number of registered births using that name in the year.

Write a program that reads both the girl's and boy's files into memory using a dictionary. The key should be the name and value should be a user defined object which is the count and rank of the name. Allow the user to input a name, the program should find the name (regardless of user's input letter case - i.e. upper or lower case) in the dictionary and print out the rank and the number of names. If the name isn't a key in the dictionary, then the program should indicate this. The program continues until "-1" is entered, and should say Exiting program. when this happens.

The first two lines, I need to open text files boynames and girlnames

Thank you so much and have a great day

Popular Names
The 2 data files: boynames.txt and girlnames.txt each contain a list of the 1000 most popular names for boys and girls in the U.S. for the year 2021 as
compiled by the Social Security Administration. These are blank-delimited files where the names are listed in order of popularity (the most popular name is
listed first and the 1000th most popular name listed last). Each line consists of the name followed by a blank space and then the number of registered births
using that name in the year. For example, the girlnames.txt file begins with:
Olivia 17728
Emma 15433
Charlotte 13285
This indicates that Olivia was the most popular name with 17,728 registered names, Emma was the second most popular with 15,433 and Charlotte was the
third most popular with 13,285.
Write a program that reads both the girl's and boy's files into memory using a dictionary. The key should be the name and value should be a user defined
object which is the count and rank of the name. Allow the user to input a name, the program should find the name (regardless of user's input letter case - i.e.
upper or lower case) in the dictionary and print out the rank and the number of names. If the name isn't a key in the dictionary, then the program should
indicate this. The program continues until "-1" is entered, and should say Exiting program. when this happens.
Example if the user enters "noah":
Enter a name (-1 to exit): noah
Noah is ranked 2 in popularity among boys with 18739 namings.
Noah is ranked 692 in popularity among girls with 415 namings.
Enter a name (-1 to exit):
Example if the user enters "ARYA":
Enter a name (-1 to exit): ARYA
Arya is not ranked among the top 1000 boy names.
Arya is ranked 120 in popularity among girls with 2320 namings.
Enter a name (-1 to exit):
Transcribed Image Text:Popular Names The 2 data files: boynames.txt and girlnames.txt each contain a list of the 1000 most popular names for boys and girls in the U.S. for the year 2021 as compiled by the Social Security Administration. These are blank-delimited files where the names are listed in order of popularity (the most popular name is listed first and the 1000th most popular name listed last). Each line consists of the name followed by a blank space and then the number of registered births using that name in the year. For example, the girlnames.txt file begins with: Olivia 17728 Emma 15433 Charlotte 13285 This indicates that Olivia was the most popular name with 17,728 registered names, Emma was the second most popular with 15,433 and Charlotte was the third most popular with 13,285. Write a program that reads both the girl's and boy's files into memory using a dictionary. The key should be the name and value should be a user defined object which is the count and rank of the name. Allow the user to input a name, the program should find the name (regardless of user's input letter case - i.e. upper or lower case) in the dictionary and print out the rank and the number of names. If the name isn't a key in the dictionary, then the program should indicate this. The program continues until "-1" is entered, and should say Exiting program. when this happens. Example if the user enters "noah": Enter a name (-1 to exit): noah Noah is ranked 2 in popularity among boys with 18739 namings. Noah is ranked 692 in popularity among girls with 415 namings. Enter a name (-1 to exit): Example if the user enters "ARYA": Enter a name (-1 to exit): ARYA Arya is not ranked among the top 1000 boy names. Arya is ranked 120 in popularity among girls with 2320 namings. Enter a name (-1 to exit):
Example if the user enters "noah":
Enter a name (-1 to exit): noah
Noah is ranked 2 in popularity among boys with 18739 namings.
Noah is ranked 692 in popularity among girls with 415 namings.
Enter a name (-1 to exit):
Example if the user enters "ARYA":
Enter a name (-1 to exit): ARYA
Arya is not ranked among the top 1000 boy names.
Arya is ranked 120 in popularity among girls with 2320 namings.
Enter a name (-1 to exit):
Example if the user enters "mITZY":
Enter a name (-1 to exit): mITZY
Mitzy is not ranked among the top 1000 boy names.
Mitzy is not ranked among the top 1000 girl names.
Enter a name (-1 to exit):
Example if the user enters "-1":
Enter a name (-1 to exit): -1
Exiting program.
• Rectangular Snip
Transcribed Image Text:Example if the user enters "noah": Enter a name (-1 to exit): noah Noah is ranked 2 in popularity among boys with 18739 namings. Noah is ranked 692 in popularity among girls with 415 namings. Enter a name (-1 to exit): Example if the user enters "ARYA": Enter a name (-1 to exit): ARYA Arya is not ranked among the top 1000 boy names. Arya is ranked 120 in popularity among girls with 2320 namings. Enter a name (-1 to exit): Example if the user enters "mITZY": Enter a name (-1 to exit): mITZY Mitzy is not ranked among the top 1000 boy names. Mitzy is not ranked among the top 1000 girl names. Enter a name (-1 to exit): Example if the user enters "-1": Enter a name (-1 to exit): -1 Exiting program. • Rectangular Snip
Expert Solution
steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Knowledge Booster
File Input and Output Operations
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