Computer Science, asked by kumarnirmal447, 4 months ago

write a Python program to create a tuple from user​

Answers

Answered by mukherjeearjun2003
1

Answer:

2

3

4

5

6

7

8

9

10

11

12

number_values = input("Provide a sequence of numbers separated by commas: ")

list_number_values = number_values.split(",")

tuple_number_values = tuple(list_number_values)

print(f"\nThis is a printed list of the number values: ")

print(f"\t{list_number_values} ")

print("\nThis is a printed tuple of the number values: ")

print(f"\t{tuple_number_values} ")

print("""\nAt first glance you may notice the list and tuple look the same,

but the list uses brackets and the tuple uses parenthesis.""")

User Input:

Answered by IzumiMiyamaru
4

Answer:

tuple1=tuple( )

num=int (input ("How many numbers:"))

element=int(input ("Enter element:"))

for i in range(0,num) :

tuple1=tuple1+(element,)

print(tuple1)

Similar questions