0
Complete the code to output "name is age years old", where name and age are the declared variable values. name = "James is"
name = "James is" age = "42 years old" print("James is" , "42 years old")
3 Answers
+ 3
Nope, I meant what i wrote. What you just posted will just cause a Name Error because James (without quotes) is not in the namespace as a variable.
It'd be:
name = "James"
age = 42
...
+ 2
if the name and age are input from user you should use the variable you create.
name = input()
age = input()
print(name, "is", age, "years old")
if you use the code you made, the print satement ahould be:
print(name, age)
0
Do you mean
name = ("James")
age = ("42")
print(name, "is", age, "years old")