Question #284428

 Write a Python program which accepts a sequence of comma-separated numbers from user and generate a list and a tuple with those numbers.

Sample data : 3, 5, 7, 23Output :List : ['3', ' 5', ' 7', ' 23']Tuple : ('3', ' 5', ' 7', ' 23')


Expert's answer

numbers = [int(x) for x in input().split(',')]
print("List: "+str(numbers))
print("Tuple: "+str(tuple(numbers)))

LATEST TUTORIALS
APPROVED BY CLIENTS