0
How to take multiple input of different types in one line
Like Name age sal email in one line
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))
+ 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.
+ 3
Input is always string in Python.
So you can only take the input in one line, but have to convert types after that.
+ 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
+ 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. 😅
+ 1
Ok thanks
+ 1
Code Crasher
ohhh it is oma slang
don't hesitate to invent your own slang.
0
Let me read your own question to you:
'How to take multiple input OF DIFFERENT TYPES in one line.'
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.