0

How to take multiple input of different types in one line

Like Name age sal email in one line

25th May 2020, 12:46 PM
ARPIT JAIN
ARPIT JAIN - avatar
12 Respostas
+ 1
if you want the input of different data type then you have to write some extra line. you can use list with with split(),that will make further operation easy. x, y = [int(x) for x in input("Enter two value: ").split()] print(type("First Number is: ", x)) print(type("Second Number is: ", y))
25th May 2020, 1:05 PM
Shobhit Pandey
Shobhit Pandey - avatar
+ 4
you get string. only and nothing else but string. you can split, iter, list - - >string🧐 conversion is at your pleasure. Shobhit Pandey shew that pleasure. another way: def converter(string) : do sth converter(input()) also a decorator might be fine. But no one in this post said sth. else but you only get string.
25th May 2020, 1:31 PM
Oma Falk
Oma Falk - avatar
+ 3
Input is always string in Python. So you can only take the input in one line, but have to convert types after that.
25th May 2020, 12:50 PM
HonFu
HonFu - avatar
+ 1
I don't ask to use input function i asked how to take .. input and when i saw on Google it show me split function
25th May 2020, 12:53 PM
ARPIT JAIN
ARPIT JAIN - avatar
+ 1
You can take multiple input of any Datatype in one line but not of different data type, you have to write one extra line of code for that. 😅
25th May 2020, 1:11 PM
Shobhit Pandey
Shobhit Pandey - avatar
+ 1
Ok thanks
25th May 2020, 1:11 PM
ARPIT JAIN
ARPIT JAIN - avatar
+ 1
Code Crasher ohhh it is oma slang don't hesitate to invent your own slang.
25th May 2020, 3:09 PM
Oma Falk
Oma Falk - avatar
0
Let me read your own question to you: 'How to take multiple input OF DIFFERENT TYPES in one line.'
25th May 2020, 1:00 PM
HonFu
HonFu - avatar
0
First of all you didn't tell how to take multiple input in one line 😅 Conversion is the 2nd step if conversion is nesscary.
25th May 2020, 1:06 PM
ARPIT JAIN
ARPIT JAIN - avatar