Question
I need to complete the following assignment in pycharm: write a program that reads the contents of the two files into separate lists. The user
I need to complete the following assignment in pycharm:
write a program that reads the contents of the two files into separate lists. The user will then be able to enter a name and the application will display messages indicating whether the name is among the most popular in each list and where the name ranked in each list.
I currently have this: which is where I took the files of the girls and boys name and appended them into a list. I know this is right. What I am struggling on is creating a while loop to ask the user to input a name.
the run of the solution should look like this. Thanks!
girlsName= [] girlsFile-open ("GirlNames.txt','r') for line in girlsFile: line-line.rstrip("In') girlsName.append (line) boysName[ boys File = open ( ' BoyNames . txt ' , for line in boysFile: ' r ' ) line = line . rstrip ( ' ' ) boysName.append (line)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started