Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please use python for this program and use #to explan the code. Thanks! I had attached the grading rubics, and the assignment 9. Heres the

please use python for this program and use #to explan the code. Thanks! I had attached the grading rubics, and the assignment 9.
Heres the link to the files:
https://drive.google.com/file/d/1QRxSDh7KRcTmPGp7ppZtoMIfIuGrz7eB/view?usp=sharing
https://drive.google.com/file/d/1R6_1Ai5K1e_RiPCCgn_pUOFxRCy13GUK/view?usp=sharing
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Sample execution: Python 3.64 Shell File Edit Shell Debug Options Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel) on win32 Type "copyright", "credits" or "license )" for more information. Window Help RESTART: P:/Cmpsc131/Programming Assignment Solutions/PA12PopularNamewithFunctions.py Enter a name to see if it is a popular girls or boys name. Enter a name to check, or "stop" to stop: Alyssa Alyssa is a popular girls name and is ranked: 14 Alyssa is not a popular boys name. Enter a name to check, or "stop" to stop: Fred Fred is not a popular girls name. Fred is not a popular boys name. Enter a name to check, or "stop" to stop: Riley Riley is a popular girls name and is ranked: 67 Riley is a popular boys name and is ranked: 107 Enter a name to check, or "stop" to stop: stop Up to -10 for not using good standard programming conventions 40 getNamesList function 10 correct function parameter 10 correct building of list from file 10 correct return of list 10 correct usage of function to get 2 lists 30 checkName function 10 correct function parameteres 10 correct calculation of return value 10 correct function return type 30 misc 10 loop for repeated asking of names 20 appropriate output using checkname's result (using returned value to decide what to print) girlname open Cv1rInames. txt."r") boynameopen( Boynanes. txt", "r") #open files istnaneofgirls = [] listnameofboys[ print ("Enter a name to see if it is a popular girls or boys name." + "In") name - input ( Enter a name to check, or "stop to stop:) for naneofgirl in girlname nameofgirl naneofgirl. rstrip( ") listname ofgirls, append(neofgrl) # vrite boys and girls nane in two different lines for nameofboy in boymame nameofboy-nameofboy. rstrip(n") listnameofboys. append (nameofboy) girlname. closed boyname. closed # close file # Create varible rank lines boyRank = 1 girlRank1 while name != "stop". i in range (len(lstneofgirls)) if nane-listnaneotgirls [1] for girlRank-i+1 for i in range (len (listnaneofboys)) if namelistnaneofboys[i boyRanki+1 # Display results if girlRank- and boyRank !-1 #when the name are in the files print (nameis a popular girls name and is ranked: " strgirlRank)) print (name + " is a popular boys ne and is ranked " + str (boyRank)) elif girlRank != 1 and boyRank-1 #when name ingirls, namen not in booys ne print (nameis a popular girls name and is ranked: print (name + is not a popular boys nane.") str(girlRank)) elif girlRank - and boyRank !- 1 #when name not in girls name files print (name is not a print (name is a popular boy' s name and is ranked str (boyRank)) lar girls name.") #other situations else: print (name + is not a popular girls name.") print (name + " is not a popular boys ne # Reset values of rank for next name boyRank = 1 gir!Rank = 1 # Loop through again run the progr agian name - inputnEnter a name to check, or "stopto stop:)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

More Books

Students also viewed these Databases questions