I was wondering if its possible to write instead of many variables and inputs in different lines of code, write all in one sentence.
Usually I’ve seen and wrote like this:
VARIABLE1 = input(var1)
VARIABLE2 = input(var2)
print(var1 + var2)
So the prompt will ask you to write 2 values in diferent sentences, because its been written that way. But is it possible to have the same output in the prompt (asking values in diferent senteces) making just one input()?
I’ve been reading about .split(), map() and lists, but the output is that the values have to be written in one sentence.
>Solution :
You can use tuple assignment:
name, age = input('What is your name? '), int(input('How old are you? '))