Why 0 in front of name variable output? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Why 0 in front of name variable output?

https://sololearn.com/coach/1032/?ref=app I cannot for the life of me determine why there is a zero in front of the name output name = input() age = input(int()) print(name + " is " + age + " years old") Results = Inputs Dave 22 Output: 0Dave is 22 years old Expected: Dave is 22 years old

27th Feb 2021, 4:01 AM
Liam Wright
Liam Wright - avatar
3 Antworten
+ 6
Because the format is age = int(input) not input(int). Also, you have to use "," instead of "+" or str() function to add integers to strings.
27th Feb 2021, 4:36 AM
Simba
Simba - avatar
+ 1
Hi. could u share ur code attempt in playground? 🙂
27th Feb 2021, 4:10 AM
Arturop
Arturop - avatar
0
Liam Wright Just take age as String input because you want to concate with String name = input () age = input ()
27th Feb 2021, 6:17 AM
A͢J
A͢J - avatar