+ 1

inputs

How can I take 3 inputs at the same time

14th Apr 2020, 3:24 PM
shreesh
3 odpowiedzi
14th Apr 2020, 3:28 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
+ 2
Yes absolutely you can, just define a method which takes input and use it 3 continuously, it will work for you
14th Apr 2020, 3:28 PM
Raj Kalash Tiwari
Raj Kalash Tiwari - avatar
+ 1
Not entirely clear for me, what you mean. But if you are looking for an input with 3 values in a single input() turn, you can do like this: # input is splitted by ',', and each separated item is mapped as integer: var1, var2, var3 = map(int, input('enter 3 numbers sep. by comma: ').split(',')) print(var1, var2, var3) # this is working similarly but using a list for storing the 3 inputs: inp = [int(i) for i in input('enter 3 numbers sep. by comma: ').split(',')] print(*[j for j in inp])
14th Apr 2020, 4:52 PM
Lothar
Lothar - avatar