Input problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Input problem

Soo I have two inputs age and name but when I run it it asks only for one input and shows error then

27th Oct 2016, 3:38 PM
sovietcat
sovietcat - avatar
9 Answers
+ 1
name = input("Please enter your name") age = input("Please enter your age") print("You are " + name + " and are " + age + " years old.") There is no error here ..... You just need to press enter and pass the values in input box like below war machine 13
27th Oct 2016, 3:48 PM
Waqas Asghar Bhalli
Waqas Asghar Bhalli - avatar
+ 1
print("you are", name, "and are", age,"years old")
27th Oct 2016, 3:54 PM
Rakesh
Rakesh - avatar
+ 1
Your code must be like this : name = input("Please enter your name") age = int(input("Please enter your age")) #Age is integer print("You are " ,name , " and are " , age , " years old.")
16th Dec 2016, 7:01 AM
Minovsky
Minovsky - avatar
0
there is some error in second input please check the second input carefully
27th Oct 2016, 3:41 PM
Rakesh
Rakesh - avatar
0
ok il try to find the error
27th Oct 2016, 3:43 PM
sovietcat
sovietcat - avatar
0
please check that you could use 'int' in second input if you use then erase it
27th Oct 2016, 3:49 PM
Rakesh
Rakesh - avatar
0
replace the + to ,
27th Oct 2016, 3:52 PM
Rakesh
Rakesh - avatar
0
name = input("Whats your name") age = input("How old are you") print("Your name is" +"name" "and you are" +"age" "years old") this is the code I made in playground I still dont understand the problem il try replacing + with , as someone suggested
27th Oct 2016, 3:55 PM
sovietcat
sovietcat - avatar
0
found the problem it was the mark thingys " "
27th Oct 2016, 3:56 PM
sovietcat
sovietcat - avatar