Answer to Question #284428 in Python for vaibhav

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')


1
Expert's answer
2022-01-03T02:51:24-0500
numbers = [int(x) for x in input().split(',')]
print("List: "+str(numbers))
print("Tuple: "+str(tuple(numbers)))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS