this problem.  In the screenshots you will see the question and my attempt to solve it.  In my attempt to solve the problem I realized that I was missing a period after "2009" so when I added the period I still got an error message in which the contents of the error message changed and it said: you displayed: Enter◦'boy',◦'girl',◦or◦'both':Enter◦a◦boy's◦name:Enter◦a◦girl's◦name:Andrew◦was◦a◦popular◦boy's◦name◦between◦2000◦and◦2009.⏎ Emma◦was◦a◦popular◦girl's◦name◦between◦2000◦and◦2009.⏎ instead of: Enter◦'boy',◦'girl',◦or◦'both':Enter◦a◦boy's◦name:Andrew◦was◦a◦popular◦boy's

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...
icon
Related questions
Question

Please help with solving this problem.  In the screenshots you will see the question and my attempt to solve it.  In my attempt to solve the problem I realized that I was missing a period after "2009" so when I added the period I still got an error message in which the contents of the error message changed and it said:

you displayed:
Enter◦'boy',◦'girl',◦or◦'both':Enter◦a◦boy's◦name:Enter◦a◦girl's◦name:Andrew◦was◦a◦popular◦boy's◦name◦between◦2000◦and◦2009.⏎
Emma◦was◦a◦popular◦girl's◦name◦between◦2000◦and◦2009.⏎

instead of:
Enter◦'boy',◦'girl',◦or◦'both':Enter◦a◦boy's◦name:Andrew◦was◦a◦popular◦boy's◦name◦between◦2000◦and◦2009.⏎
Enter◦a◦girl's◦name:Emma◦was◦a◦popular◦girl's◦name◦between◦2000◦and◦2009.⏎

NEXTO
VVOINUCIILII
Exercise 71410 x
Exercise 71410 x
WORK AREA
RESULTS
RESULTS
Reagane
Mollya
Alexandrad
Violeta
Charlied
Juliad
Sadied
Rubya
Evad
Aliced
Elianad
Taylord
Callied
Peneloped
Camillad
Baileyd
Kaelynd
Alexisa
Kaylad
Katherined
Sydneya
Laurena
Jasmined
Londone
Bellad
Adelined
Carolined
Viviand
bulianad
Giannad
Skylere
Jordyn
lyou displayed:
Enter-'boy',-'girl",-or-'both':Enter•a•girl's-name:Emma-was-a-popular-girl's-name-between-2000-and-20094
WORK AREA
CODELAB ANALYSIS: LOGICAL ERROR(S)
Problems Detected:
The contents of your standard output is incorrect.
Given the following was entered from the keyboard:
girla
Emma
|, and the file 'BoyNames.txt' initially contains:
þacksone
Andrewa
Aidend
Liama
Lucase
Noaha
Masone
þaydend
Ethand
þacobe
þacke
Cadend
Logand
Benjamind
Michaeld
Caleba
Ryand
Alexanderd
Elijaha
þamesd
Williama
Olivera
Connora
h. ...
instead of:
Enter-'boy', 'girl",-or•'both':Enter•a•girl's-name:Emma-was-a-popular-girl's-name-between-2000-and-2009.a
Transcribed Image Text:NEXTO VVOINUCIILII Exercise 71410 x Exercise 71410 x WORK AREA RESULTS RESULTS Reagane Mollya Alexandrad Violeta Charlied Juliad Sadied Rubya Evad Aliced Elianad Taylord Callied Peneloped Camillad Baileyd Kaelynd Alexisa Kaylad Katherined Sydneya Laurena Jasmined Londone Bellad Adelined Carolined Viviand bulianad Giannad Skylere Jordyn lyou displayed: Enter-'boy',-'girl",-or-'both':Enter•a•girl's-name:Emma-was-a-popular-girl's-name-between-2000-and-20094 WORK AREA CODELAB ANALYSIS: LOGICAL ERROR(S) Problems Detected: The contents of your standard output is incorrect. Given the following was entered from the keyboard: girla Emma |, and the file 'BoyNames.txt' initially contains: þacksone Andrewa Aidend Liama Lucase Noaha Masone þaydend Ethand þacobe þacke Cadend Logand Benjamind Michaeld Caleba Ryand Alexanderd Elijaha þamesd Williama Olivera Connora h. ... instead of: Enter-'boy', 'girl",-or•'both':Enter•a•girl's-name:Emma-was-a-popular-girl's-name-between-2000-and-2009.a
/jsp/core_dhtml.jsp?
jsp/core_antmijsp?
VVUIKUCIILIT
Exercise 71410 x
Exercise 71410 X
WORK AREA
RESULTS
WORK AREA
RESULTS
SUBMIT
# list containg boys and grils name read from file
If you have downloaded the source code from this book's companion web site, you
will find the following files in the Chapter 07 folder:
girllist - []
4 boylist - [
• GrINames.txt--This file contains a list of the 200 most popular names given to
girls born in the United States from the year 2000 through 2009.
• BoyNames.txt--This file contains a list of the 200 most popular names given to
boys born in the United States from the year 2000 through 2009.
5 with open("GirlNames.txt") as fh:
for name in fh:
name - name.rstrip("\n")
girllist.append (name)
8
Write a program that reads the contents of the two files into two separate
lists, allows a user to input either a girl's name, a boy's name, or
both, then tells the user whether the name(s) was/were popular between 2000 and
2009.
10 with open("BoyNames.txt") as fh:
11
12
13
14
15 def print_girl_name_popularity(girlName):
for name in fh:
name = name.rstrip("\n")
boyList.append(name)
First, the program should prompt the user to choose a girl's name, a boy's name,
or both by entering either 'girl", 'boy', or 'both.
if giriName in girllist:
print(girlName + " was a popular girl's name between 2000 and 2009")
print(girlName +" was not a popular girl's name between 2000 and 2009")
else:
Once they have chosen, they should be able to input a name. If the name was
a popular name, like Jacob or Sophia, the program should print "Jacob was a
popular boy's name between 2000 and 2009." or "Sophia was a popular girl's name
between 2000 and 2009."
17
18
19
20
21 def print_boy_name_popularity(boyName):
22
23
24
if boyName in boylist:
print(boyName +" was a popular boy's name between 2000 and 2009")
else:
print(boyName +" was not a popular boy's name between 2000 and 2009")
25
26
27 girlBoyBoth = input("Enter 'boy', 'girl', or 'both':")
28 if gir1BoyBoth == 'girl':
29
30
31 elif gir1BoyBoth == "boy':
If the name was not a popular name, like Voldemort, the program should print
"Voldemort was not a popular boy's name between 2000 and 2009."
girlName = input("Enter a girl's name:")
print girl_name_popularity(giriName)
If the user chooses to input both a girl and boy's name, ask for the boy's name,
then the girl's name, and print two statements in the form mentioned above on
two separate lines, with the statement about the boy's name coming first.
For example, if the user inputs Voldemort and then Sophia, print:
boyllame = input("Enter a boy's name:")
print_boy_name_popularity(boyName)
33
34 elif girlBoyBoth == "both':
Voldemort was not a popular boy's name between 2000 and 2009.
Sophia was a popular girl's name between 2000 and 2009.
boyllame = input("Enter a boy's name:")
girlName = input ("Enter a girl's name:")
print_boy_name_popularity(boyName)
print girī_name_popularity(girlName)
37
38
SAMPLE RUN #3: python3 NameSearch.py|
Interactive Session
Hide Invisibles
Enter. 'boy',. 'girl',-or.'both':girl-
Enter.a girl's- name: Emma
Emma - was a popular girl's name between - 2000 - and - 2009.
Transcribed Image Text:/jsp/core_dhtml.jsp? jsp/core_antmijsp? VVUIKUCIILIT Exercise 71410 x Exercise 71410 X WORK AREA RESULTS WORK AREA RESULTS SUBMIT # list containg boys and grils name read from file If you have downloaded the source code from this book's companion web site, you will find the following files in the Chapter 07 folder: girllist - [] 4 boylist - [ • GrINames.txt--This file contains a list of the 200 most popular names given to girls born in the United States from the year 2000 through 2009. • BoyNames.txt--This file contains a list of the 200 most popular names given to boys born in the United States from the year 2000 through 2009. 5 with open("GirlNames.txt") as fh: for name in fh: name - name.rstrip("\n") girllist.append (name) 8 Write a program that reads the contents of the two files into two separate lists, allows a user to input either a girl's name, a boy's name, or both, then tells the user whether the name(s) was/were popular between 2000 and 2009. 10 with open("BoyNames.txt") as fh: 11 12 13 14 15 def print_girl_name_popularity(girlName): for name in fh: name = name.rstrip("\n") boyList.append(name) First, the program should prompt the user to choose a girl's name, a boy's name, or both by entering either 'girl", 'boy', or 'both. if giriName in girllist: print(girlName + " was a popular girl's name between 2000 and 2009") print(girlName +" was not a popular girl's name between 2000 and 2009") else: Once they have chosen, they should be able to input a name. If the name was a popular name, like Jacob or Sophia, the program should print "Jacob was a popular boy's name between 2000 and 2009." or "Sophia was a popular girl's name between 2000 and 2009." 17 18 19 20 21 def print_boy_name_popularity(boyName): 22 23 24 if boyName in boylist: print(boyName +" was a popular boy's name between 2000 and 2009") else: print(boyName +" was not a popular boy's name between 2000 and 2009") 25 26 27 girlBoyBoth = input("Enter 'boy', 'girl', or 'both':") 28 if gir1BoyBoth == 'girl': 29 30 31 elif gir1BoyBoth == "boy': If the name was not a popular name, like Voldemort, the program should print "Voldemort was not a popular boy's name between 2000 and 2009." girlName = input("Enter a girl's name:") print girl_name_popularity(giriName) If the user chooses to input both a girl and boy's name, ask for the boy's name, then the girl's name, and print two statements in the form mentioned above on two separate lines, with the statement about the boy's name coming first. For example, if the user inputs Voldemort and then Sophia, print: boyllame = input("Enter a boy's name:") print_boy_name_popularity(boyName) 33 34 elif girlBoyBoth == "both': Voldemort was not a popular boy's name between 2000 and 2009. Sophia was a popular girl's name between 2000 and 2009. boyllame = input("Enter a boy's name:") girlName = input ("Enter a girl's name:") print_boy_name_popularity(boyName) print girī_name_popularity(girlName) 37 38 SAMPLE RUN #3: python3 NameSearch.py| Interactive Session Hide Invisibles Enter. 'boy',. 'girl',-or.'both':girl- Enter.a girl's- name: Emma Emma - was a popular girl's name between - 2000 - and - 2009.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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 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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY