Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains

34,67,55,33,12,98 Then, the output should be: ['34', '67', '55', '33', '12', '98'] ('34', '67', '55', '33', '12', '98') Hints: In case of input data being supplied to the question, it should be assumed to be a console input. tuple() method can convert list to tuple

14th Aug 2017, 3:27 PM
ⓢⓐⓝⓓⓔⓔⓟ
ⓢⓐⓝⓓⓔⓔⓟ - avatar
4 Answers
+ 2
me too, here my try: https://code.sololearn.com/cnRv3Z0LbxGJ/#py also I did that kind of conversion on: https://code.sololearn.com/WZKmo7mHodUK/#
14th Aug 2017, 7:35 PM
ysraelcon
ysraelcon - avatar
+ 1
Not sure if this is correct but here's my try: https://code.sololearn.com/cONsH6VYYgEu
14th Aug 2017, 6:43 PM
Garikai
Garikai - avatar
+ 1
values = input("34,67,55,33,12,98") list = values.split(",") tuple = tuple(list) print('List : ',list) print('Tuple : ',tuple)
1st Jun 2020, 5:37 PM
Himanshu Khandelwal
Himanshu Khandelwal - avatar
0
I'll do this when I got off work
14th Aug 2017, 3:46 PM
Vari93
Vari93 - avatar