Generate a list and tuple with comma-separated numbers
List_a=input().split()
Tup_a=tuple(List_a)
values = input("Input some comma seprated numbers : ")
list = values.split(",")
tuple = tuple(list)
print('List : ',list)
print('Tuple : ',tuple)
n=[1, 2, 3, 4, 5]
m=(1, 2, 3, 4, 5)
print("list:- ",n)
print("tuple:- ",m)
good. try it in the way to get input from user side
values = input("Input some comma seprated numbers : ")
list = (values.split)
tuple = tuple(list)
print(List : ,list)
print(Tuple : ,tuple)
numbers = input("Input some comma-separated numbers : ")
list = (values.split)
tuple = tuple(list)
print(List : ,list)
print(Tuple : ,tuple)
Num1= int(input(“enter the string”)
Num2= int(input(“enter the string”)
Num3= int(input(“enter the string”)
Num4= int(input(“enter the string”)
#tuple
for i in range(1,5)
i=tuple(i)
print(i “,”)
i=list(i)
print(i “,”)
values = input("Input some comma seprated numbers : ")
list = values.strip(“,”)
tuple = tuple(list)
print('List : ',list)
print('Tuple : ',tuple)
values = input("Input some comma seprated numbers : ")
list = values.split(“,”)
tuple = tuple(list)
print('List : ',list)
print('Tuple : ',tuple)
li = []
for i in range(100, 401):
s = str(i)
if (int(s[0])%2==0) and (int(s[1])%2==0) and (int(s[2])%2==0):
li.append(s)
print(‘Generate a list with comma-separated numbers:’)
print( “,”.join(li))
tu = ()
tu = tuple(li)
print(‘Generate a tupple with comma-separated numbers:’)
print(“,”.join(tu))
Solution:
a = input("Enter the sequence of numbers to create list: ")
b = input(“Enter the sequence of numbers to create tuple:”)
a1 = map(int, a.split(“,”))
b1= map(int, b.split(“,”))
a_list = list(a1)
b_tuple = tuple(b1)
print(a_list)
print(b_tuple)
Please find the solution I have posted in reply.
Please find the solution I have posted in reply.
Good. Please find the solution I have posted in reply.
Good try, but you have to convert the number into int format. Please find the solution I have posted in reply.
Good try! Please find the solution I have posted in reply.
Good try. Please the solution I have posted in reply.
Please the solution i have posted in reply.