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')
numbers = [int(x) for x in input().split(',')]
print("List: "+str(numbers))
print("Tuple: "+str(tuple(numbers)))
Comments
Leave a comment