how to input a tuple in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

how to input a tuple in python

I do not know how to input a tuple in a single line The tuple contains 3 integers

3rd Apr 2018, 11:16 AM
ManYin Cheung
ManYin Cheung - avatar
3 Answers
+ 5
tup = int(input("")), int(input("")),int(input(""))
3rd Apr 2018, 11:22 AM
Oma Falk
Oma Falk - avatar
+ 4
tup = tuple(map(int,input().strip().split())) Works in python 3.x
3rd Apr 2018, 12:33 PM
Mohammed Numan
+ 2
thx
4th Apr 2018, 6:59 AM
ManYin Cheung
ManYin Cheung - avatar