1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Jet001 [13]
3 years ago
6

Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy’s name,

a girl’s name, or both, and the application will display messages indicating whether the names were among the most popular.
Computers and Technology
1 answer:
insens350 [35]3 years ago
3 0

Answer:

Check Explanation.

Explanation:

A programming language is used by engineers, technologists, scientists or someone that learnt about programming languages and they use these programming languages to give instructions to a system. There are many types for instance, c++, python, Java and many more.

So, the solution to the question above is given below;

#define the lists

boyNames=[]

girlNames=[]

#open the text file BoyNames.txt

with open('BoyNames.txt','r') as rd_b_fl:

boyNames=rd_b_fl.readlines()

boyNames=[name.strip().lower() for name in boyNames]

#open the text file GirlNames.txt

with open('GirlNames.txt','r') as rd_b_fl:

girlNames=rd_b_fl.readlines()

girlNames=[name.strip().lower() for name in girlNames]

#print the message to prompt for name

print('Enter a name to see if it is a popular girls or boys name.')

while True:

#prompt and read the name

name=input('\nEnter a name to check, or \"stop\" to stop: ').lower()

# if the input is stop, then exit from the program

if name=='stop':

break

# If the girl name exits in the file,then return 1

g_count=girlNames.count(name)

# if return value greater than 0, then print message

if g_count>0:

print(name.title()+" is a popular girls name and is ranked "

+str(girlNames.index(name)+1))

# if return value greater than 0, then print message

#"Not popular name"

else:

print(name.title()+" is not a popular girls name")

## If the boy name exits in the file,then return 1

b_count=boyNames.count(name)

if b_count>0:

print(name.title()+" is a popular boys name and is ranked "

+str(boyNames.index(name)+1))

# if return value greater than 0, then print message

#"Not popular name"

else:

print(name.title()+" is not a popular boys name")

You might be interested in
What best describes "broadband access"?
Andre45 [30]

Answer:

The Correct option is : d. BROADBAND ACCESS enable users to connect to a high speed networks

Explanation:

As the names implies BROADBAND ACCESS can be defined as a technology that enables users to have the access to fast and high speed internet connection when browsing, streaming or downloading reason been that BROADBAND ACCESS is more faster and quicker which inturn enables the user to do a lot more on the internet which is why BROADBAND ACCESS is often refer or known as a high and fast speed Internet access connection.

5 0
3 years ago
Jake was working on an essay for his English class on a stormy Sunday afternoon. Before he could save his document, a big strike
matrenka [14]

Maybe in atosave, Computers mostly save what your working on :3

8 0
3 years ago
onsider the following program: Peform a total of six exercises. Select one exercise from each of the following areas: hips and l
Leviafan [203]

Answer:

Beginner

Explanation:

A program like this is ideal for a beginning exerciser due to the high number of repetitions and the sets are not much.

Cheers

3 0
3 years ago
Im timed!!!!!!!!!!!!!!!!!!<br><br> I NEED HELP ASAP<br> THANK YOU SO MUCH
Troyanec [42]

Answer:

card sorting

Explanation:

tell me if im wrong...

6 0
3 years ago
Read 2 more answers
The weight of your car will also affect its_____.
Usimov [2.4K]

Answer: C

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Of the different IRT roles, the _______________ is head of the team and issues the ultimate call regarding how to respond to an
    15·1 answer
  • Individuals with desirable traits will be __________ to have young that survive than individuals without these traits. (2 points
    5·2 answers
  • A ____ is a collection of computers and users that are identified by a common security database. workgroup controller segment do
    7·1 answer
  • Your boss bought a new printer with a USB 3.0 port, and it came with a USB 3.0 cable. Your boss asks you:
    7·2 answers
  • Pleaseeee help me w this!
    10·1 answer
  • Convert the following hexadecimal numbers to decimal numbers. (Show your work) a. 0xE3 b. 0x4A c. 0xF9
    10·1 answer
  • You are a Data Scientist at Anthem Blue Cross Blue Shield. You want to check if a patient will develop diabetes. Please write th
    5·1 answer
  • What do you suggest for Father's Day?​
    7·1 answer
  • PLEASE HURRY!!!!<br> Look at the image below
    8·1 answer
  • Using C++
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!