name = input() age = input() print(name + " is " + age) | SoloLearn: Learn to code for FREE!

+1

name = input() age = input() print(name + " is " + age)

I don't understand WHY it keeps giving me an error...when all I do is fill in like my name for instance, andy and my age, 47...says Andy not defined..

1/23/2021 6:28:00 PM

Ruthless SmAk

10 Answers

New Answer

+6

We have to use int() function to age since it's an integer. But we can't add an integer to strings. That's why str() function is used. So, your code needs to be name = input() age = int(input()) print(name + " is " + str(age))

+4

Ruthless SmAk Ahh you only need to give inputs in two lines Kiibo 100

+2

Its not giving any warnings or error check it once again name = input() age = input() print(name + " is " + age)

+2

Simba...Bless you bruh! Sometimes I need it spelled out for me, and with being 47 years old + adhd + dyslexia = syntax error half the time!😂

+2

Or you can do that in this way: print(f"{name} is {age}")

+1

Tyvm Kiblo!!!🙏

+1

0

Ohhhhhh...replace "name and "age" in the print line with actual input...🤦‍♂️😂 tyvm bruh!🙏🤙✌

0

I'm sorry I did type that...but you know these so called smartphones now a days..dang fangled devices, well that and ADHD, 3 small kids screaming "Why haven't you feed me dooood?"...🤯😂🤙

0

#name is a string name=input() #age is a integer value age=int(input()) Now it will work fine