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
GREYUIT [131]
3 years ago
10

NAME SEARCH In the Chap07 folder of the Student Sample Programs, you will find the following files: GirlNames.txt—This file cont

ains a list of the 200 most popular names given to girls born in the United States from 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 2000 through 2009. Create an application that reads the contents of the two files into two separate arrays or Lists. The user should be able to enter a boy’s name, a girl’s name, or both, and the application should display messages indicating whether the names were among the most popular.
Computers and Technology
1 answer:
Tems11 [23]3 years ago
4 0

Answer:

Explanation:

I do not have the files listed in the question so I have made two test files with the same names. This code is written in Python, we are assuming that the names on each file are separated by newlines.

f1 = open("GirlNames.txt", 'r')

f1_names = f1.read()

f1_names_list = f1_names.split('\n')

f2 = open("BoyNames.txt", 'r')

f2_names = f2.read()

f2_names_list = f2_names.split('\n')

print(f1_names_list)

print(f2_names_list)

boy_or_girl = input("Would you like to enter a boy or girl name or both: ").lower()

if boy_or_girl == 'boy':

   name = input("Enter name: ")

   if name in f2_names_list:

       print("Yes " + name + " is in the list of most popular boy names.")

   else:

       print("No, it is not in the list")

elif boy_or_girl == 'girl':

   name = input("Enter name: ")

   if name in f1_names_list:

       print("Yes " + name + " is in the list of most popular girl names.")

   else:

       print("No, it is not in the list")

elif boy_or_girl == 'both':

   girlname = input("Enter Girl name: ")

   if girlname in f1_names_list:

       print("Yes " + girlname + " is in the list of most popular girl names.")

   else:

       print("No, it is not in the list")

   boyname = input("Enter name: ")

   if boyname in f2_names_list:

       print("Yes " + boyname + " is in the list of most popular girl names.")

   else:

       print("No, it is not in the list")

else:

   print("Wrong input.")

You might be interested in
What is the use of consonant in QBASIC ? Answer me in short and easy answer.​
Digiron [165]

Answer:

See Explanation

Explanation:

I'll assume the question is about the use of constants in QBasic because consonants do not have any special function or usage in QBasic.

In simple terms: In QBasic, constants are used to represent elements that do not change in value during program execution.

Take for instance, you intend to use \pi in your program.

Its value is \pi = 3.142

So, 3.142 will always be a constant in your program. One of the ways it can be used in a program is:

10 LET PI = 3.142

<em>The above represents a numeric constant. QBasic also have string constants.</em>

3 0
3 years ago
Complete the sentence. Assigning a data value to a variable in a program is referred to as______.
luda_lava [24]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct answer to this question is initialization.

When you write a variable in a program,  for example int firstNumber. The integer variable firstNumber is declaring in the program.

when you assign a data value to a variable in a program is referred to as initialization. for example:

firstNumber=10;

You can declare and initialize the variable in one statement such as:

int firstNumber=10;

6 0
3 years ago
You have a large company, and it is important to your business that your employees' work is backed up regularly. Which network w
Artyom0805 [142]
It really depends on what you doing GUI is best for high graphics output
6 0
3 years ago
Read 2 more answers
What is the maximum value for any octet in an ipv4 ip address?
VladimirAG [237]
They're bytes consisting of 8 bits, so the max value is 2^8-1 = 255
3 0
3 years ago
The result or product of a process is called _____.
marissa [1.9K]
It would have to be output
6 0
3 years ago
Read 2 more answers
Other questions:
  • Which forensics tool would you use to reveal recent pages viewed via the internet explorer browser?
    10·1 answer
  • Absolute time would be most similar to :
    9·1 answer
  • Problems and Exercises 16 through 43 are based on the entire ("big" version) Pine Valley Furniture Company database. Note: Depen
    13·1 answer
  • Lol who look at this so funny
    6·1 answer
  • A function is executed when it is
    7·1 answer
  • What is the best stratiget to avoid paying intrest in your credit cared
    13·1 answer
  • Microsoft vs Sony who wins ​
    13·2 answers
  • An information system is the set of steps that needs to be followed to ensure that software development proceeds in an orderly f
    13·1 answer
  • What software application is most appropriate to use to create multimedia presentations?
    6·2 answers
  • How does the dns solve the problem of translating domain names like example.com into ip addresses?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!