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")

3rd Jul 2022, 7:20 PM
Roshan Singh
Roshan Singh - avatar
3 ответов
+ 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 ...
3rd Jul 2022, 7:29 PM
Slick
Slick - avatar
+ 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)
3rd Jul 2022, 7:26 PM
Slick
Slick - avatar
0
Do you mean name = ("James") age = ("42") print(name, "is", age, "years old")
3rd Jul 2022, 7:28 PM
Roshan Singh
Roshan Singh - avatar