Write a program that asks the user how many names they have. (If they have a first name, two middle names, and a last name, for example, they would type 4.) Then, using a for loop, ask the user for each of their names. Finally, print their full name.

Answers

Answer 1

Answer:

The solution is implemented in python:

numnames = int(input("Number of Names: "))

nametitle = ["Surname: ","Firstname: ","Middlename: ","Middlename 2: "]

names = []

for i in range(numnames):

   name = input(nametitle[i])

   names.append(name)

   

print("Your fullname is: ",end=" ")

for i in names:

   print(i,end=" ")

Explanation:

This prompts user for number of names

numnames = int(input("Number of Names: "))

This lists the name titles in a list

nametitle = ["Surname: ","Firstname: ","Middlename: ","Middlename 2: "]

This initializes an empty list

names = []

The following for loop get names from the user

for i in range(numnames):

   name = input(nametitle[i])

   names.append(name)

   

The following instructions print the user fullnames

print("Your fullname is: ",end=" ")

for i in names:

   print(i,end=" ")

Answer 2

An example program in Python that asks the user for the number of names they have and then prompts them to enter each name.

It will then print their full name based on the names provided:

python

Copy code

num_names = int(input("How many names do you have? "))

names = []

for i in range(num_names):

   name = input("Enter name {}: ".format(i + 1))

   names.append(name)

full_name = " ".join(names)

print("Your full name is:", full_name)

In this program, we first ask the user to enter the number of names they have. The input is converted to an integer using int() since input() returns a string.

Then, we initialize an empty list names to store the names provided by the user.

Next, we use a for loop that iterates num_names times to ask the user for each name. The loop variable i starts from 0, so we add 1 to it when displaying the prompt using i + 1.

Inside the loop, we prompt the user to enter the name and append it to the names list. After the loop completes, we join all the names in the names list using the join() method with a space as the separator. This creates a single string representing the full name.

Learn more about python on:

https://brainly.com/question/30391554

#SPJ6


Related Questions

The illegal copying of program​

Answers

Answer:Software piracy

Explanation:

Problem decomposition means
O Fixing the problem
O Solving the problem
O Breaking down tasks into smaller, manageable parts
0 None of the above
PLEASE HELPPPPPP

Answers

Answer: Breaking down tasks into smaller, manageable parts

Explanation:

The word decomposition means to break down so Problem decomposition means to break down the problem being faces into smaller parts with the reason being to be able to manage it better.

Some problems are simply too large to handle singularly because of the amount of resources that would have to be devoted. It would be better to break them down into smaller tasks that can then be be confronted one at a time with enough resources to solve them each.

draw internal architecture of computer​

Answers

Answer:

If this is good, let me know in the comments and I'll draw it

Explanation:

what security issues could result if a computer virus or malware modifies your host file in order to map a hostname to another IP address

Answers

Answer:

Man-in-the-middle attack

Explanation:

In this type of attack, the hacker uses the virus or malware to get and change his IP address and hostname to match the address and hostname of the target host computer. The allows the hacker to gain access to information sent to the target IP address first.

Other Questions
which image shows a non renewable resource?1234 What is the primary holiday in Brazil?ChristmasCarnivalIndependence DayEaster Which of these was one of the beliefs of the ancient Egyptians? A $96.00 item is marked down by 25%what is the new cost of the item?round if needed i need help pls help me 865.3 divided by 5 ...? Need help pls very important 25 points here for person who gives good answer will get brainlyest 6 2/1 (2 8/1 )+3 3/2 What is the answer??? Find all solutions in the interval [0, 2pi). tanx+ secx =1a) x=pi/4b) x=0c) x=5pi/4d) no solution How do Attias thoughts and ideas about obesity and insulin resistance speak to the enormous role that science plays in nutrition and health? Need this very badly The current temperature is 30C. Over the next eight hours the temperature decreases and then increases, returning back to 30C. if the temperature initially decrease by 13C, how much did it subsequently increase? Mi piel est muy roja.what does piel mean?facethumbcerebroskin how do alcohol tobacco and other drugs affect the central nervous system Evaluate 3m - 5 when m=9Thank you!! Maribel sold 20% of the cupcakes she made. If she sold 35 cupcakes, then she made how many cupcakes in all. Bam hi cuts between what bases Graph the linear equation using intercepts. Use a graphing calculator to check your graph.equations: y= 2/3 x (-4)y= 1/9x (-3) This Boston politician was a Revolutionary figure and was a member of the Committee of Correspondence, took a leadership role inthe events that led to the Boston Tea Party, and helped to draft the Articles of ConfederationA) john adamsB) paul revere C) smauel adamsD) william dawes