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
Each AWS region is composed of two or more locations that offer organizations the ability to operate production systems that are
Luba_88 [7]

Answer:

The answer is "Option a"

Explanation:

It is an isolated region insulated from errors in most other Accessibility Areas and provides low-cost, network connectivity to all other Accessibility Locations in the same country. The positions of the AWS data centers were not described in terms of duplication regions, regional areas or computing areas, and wrong choices were explained as follows:

  • In option b, In the AWS there is no use of the replication area, that's why it's incorrect.
  • In option c, It is used in a single purpose, that's why it's incorrect.
  • In option d, It provides the accessibility to the user to access the large amount of data, that's why it is wrong.
4 0
3 years ago
What is a thicknet?
pashok25 [27]
A type of coaxial cable
7 0
3 years ago
1-5. Discuss briefly the function and benefits of computer network. (5pts​
Elden [556K]

Computer networks allow an unlimited amount of computers to communicate with each other. This is especially useful in enterprise environments, as technicians have to deal with hundreds of computers at a time. Computer networks make it easier to share files, increase storage capacity, better communication, easier to to control computers remotely, easier to share resources, ability to share a single internet connection on multiple devices. Computer networks also have a lot of cost benifits too, as network administration is centralised, meaning that less IT support is required, and you can cut costs on sharing peripherals and internet access.

Hopefully this helps you out!

7 0
3 years ago
Which task option will keep you aware of the progress of a task you assign?
tekilochka [14]

Answer:

It's C

Explanation:

Correct on edg

3 0
3 years ago
Read 2 more answers
During slide show mode, hitting the B key will do which of these things?
tia_tia [17]

Answer:

move to the first page?

6 0
3 years ago
Read 2 more answers
Other questions:
  • How does a combustion engine works?
    7·2 answers
  • The ____ is the point in the past to which the recovered applications and data at the alternate infrastructure will be restored.
    15·1 answer
  • Each professional association has
    7·1 answer
  • In this project you will demonstrate your knowledge of decision making blocks such as if statements. Objectives Building on ever
    11·1 answer
  • Why do ineed to upgrade to see answers isnt it enough adds
    15·2 answers
  • I love the brainly update guys! :)
    5·2 answers
  • Write a program that prompts the user to enter a date, using integer values for the month, day, and year, and then prints out th
    9·1 answer
  • What is the purpose of this parallelogram shape in a flowchart?
    15·1 answer
  • Explain input device​
    9·2 answers
  • Add criteria to this query to return only the records where the value in the SubscriptionType field is Self or Family and the va
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!