Computer Science, asked by PrathamMarwaha3654, 19 days ago

Take three names as input from the user. Store these names in a list. Shift all the three names to a single variable and delete the list.

Answers

Answered by lakshyaarora0477
3

a=input("Enter the first name")

b=input("Enter the second name")

c=input("Enter the third name")

names=[ ]

names.append(a)

names.append(b)

names.append(c)

Explanation:

first I asked for an input from the user and stored in the variable 'a'

then I asked for the input of second name and stored it in 'b'

then I asked for the input of third name and stored it in variable 'c'

then I made an empty list of names

and then I added the values of a,b and c in that list of names using the append function .

Answered by ishwaryam062001
0

Answer:

We delete the listing names_list the usage of the del key-word and print the shifted names the usage of the print() function.

Explanation:

From the above question,

name1 = input("Enter name 1: ")

name2 = input("Enter name 2: ")

name3 = input("Enter name 3: ")

# Store the names in a list

names_list = [name1, name2, name3]

# Shift the names to a single variable

all_names = " ".join(names_list)

# Delete the list

del names_list

# Print the shifted names

print("All names:", all_names)

In this code, we first take three names as enter from the person the use of the input() characteristic and keep them in the variables name1, name2, and name3.

Then,

          we create a listing names_list containing these three names.

Next,

          we use the join() technique of string to concatenate the names in the listing with a house separator and save the ensuing string in the variable all_names.

Finally, we delete the listing names_list the usage of the del key-word and print the shifted names the usage of the print() function.

For more such related questions : https://brainly.in/question/47358583

#SPJ2

Similar questions