+ 2
How to take two inputs In python? My code is showing error
6 Answers
+ 4
You need to enter them on two lines, like this:
lion
22
+ 6
|| H A C K E R Z 2 0 2 1 || ,
as already mentioned from lion , the input in sololearn playground has to be done in 2 separate lines in the input window that pops up before the code is executed.
to get spaces in the output between the arguments of the print() function, it is easier to use a comma ',' to separate them than using plus operator '+' for concatenation:
print(name, "and", age)
+ 1
Even better with f-string:
print ( f â {name} @ {age} ? â )
(spaces added only for clarity)
+ 1
Hold on, I told you slightly wrong thing: spaces WITHIN string are as you exactly want them - Python will ignore anything outside it. Sorry, just realised I wasnât clear.
Basically try to use f-string when you need some changeable values to be embedded within output, this way youâll never have to concatenate or cast into str/int.
0
have you tried to isolate the first part with brackets?
print ((name+"and"),age)
0
Monika Monika personally message kro