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

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 1GZ
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
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr