0
I am so stuck at the practice test output: (james is 42 years old)
I have tried everything can’t get past it. Name = “james” Age = “42” Need advice I tried the following: Print(“Name” + “is” + “age” + “years old”) Print(Name, + “is” + Age, + “years old”) I don’t even remember other things i kept trying but the closest i got to was output (Jamesis 42 years old)
10 Respuestas
+ 6
Try
print(f"{Name} is {Age} years old")
The f means that it's a format string, and you can put variables inside the curly braces, and it will output the value of the variables.
+ 4
You can do it without formatting like this:
print(Name + ' is ' + Age + ' years old.')
Notice the spaces inside the quotation marks.
+ 3
Jamal Game George Mathew JOHNNY BOSCO Ejeh Joseph Simon Emeka C. Acorpseinprogress thankyou so much you guys are too kind and like some of you said my error was in spacing and correct use of + . I finally got it right 🙏☺️☺️
+ 2
Here.To.Learn if you ever have any other questions I'd be happy to help(if I can) in dms, so offer is always open :)
0
you don't put spaces between words
0
Vasiliy is this correct ?
Print(“name”+”is”+”age”+”years old”)
0
➵Chloe[she/her] [DMs Open] thanks alot this worked ! Iam not familiar woth the Format string yet maybe the practice test came up way too early in the course thanks alot for helping ♥️
0
Simon Sauter thankyou ! I think this insight about correct spacing is what i was missing! Very helpful
0
I think where you error is, is from your spacing between the quotation I think one of this can help you out.
Print (f" {Name} + is + {Age} + years old ")
Or
Print (Name + " is " + Age + " years old ")
I think one of this can help you out.
It's nice you learn something out if your profession I love and this is one of the best things you can do. # Don't quote me wrong.
0
you can use only single or double quotes.
Name = "james"
Age = "42"
print(Name+" is "+Age+" years old")