Assume the file popular_names.txt contains the 400 most popular names given to children born in the United States from the year 2000 through 2009. The file contains 400 lines, with one name per line. Write a Python program that reads the contents of the file into a list. The program should display the following string to prompt the user to enter a name: 'Entet a name: ' The program should then display a message indicating whether the name is among the most popular. If the name is found in the list, the program should display the following message: 'That was a popular name between 2000 and 2009.' If the name is not found in the list, the program should display the following message: 'That was not a popular name between 2000 and 2009.' Look carefully at the samples given. In the first example, the user enters a name that is found in the list. In the second example, the user enters a name that is not found in the list. Carefully notice the wording of the messages and the placement of the spaces and colons. The program's output must match this. Sample Run 1: Enter a name: Isabella That was a popular name between 2000 and 2009. Sample Run 2: Enter a name: Voldemort That was not a popular name between 2000 and 2009.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter14: Introduction To Swing Components
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question
100%
Assume the file popular_names.txt contains the 400 most popular names given to children born in the United States from the year 2000 through 2009. The file contains 400 lines, with one name per line. Write a Python program that reads the contents of the file into a list. The program should display the following string to prompt the user to enter a name: 'Entet a name: ' The program should then display a message indicating whether the name is among the most popular. If the name is found in the list, the program should display the following message: 'That was a popular name between 2000 and 2009.' If the name is not found in the list, the program should display the following message: 'That was not a popular name between 2000 and 2009.' Look carefully at the samples given. In the first example, the user enters a name that is found in the list. In the second example, the user enters a name that is not found in the list. Carefully notice the wording of the messages and the placement of the spaces and colons. The program's output must match this. Sample Run 1: Enter a name: Isabella That was a popular name between 2000 and 2009. Sample Run 2: Enter a name: Voldemort That was not a popular name between 2000 and 2009.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT