- 3

how to get the output James is 42 years old

name="James" age="42"

10th Aug 2021, 4:56 PM
Zelda
Zelda - avatar
8 odpowiedzi
+ 4
Md Ayaz , no you didn't. Look at your code. Your code will give error. Because: 1."James +" is not "+" 2. False (or 0) can not be concatenated with 42 (int) and string... 3.And even in the rest of the concatenation there is mistake. 4. + Must be between two strings. Be careful with open and close quotes
10th Aug 2021, 5:25 PM
Shadoff
Shadoff - avatar
+ 2
Where is your attempt and language information?
10th Aug 2021, 5:01 PM
JaScript
JaScript - avatar
+ 2
print("James + " is "+" 42"+ " years old")
10th Aug 2021, 5:05 PM
Zelda
Zelda - avatar
+ 2
#1 print("James is 42 years old") #2 name="James" age=42 print(f"{name} is {age} years old") #3 print(name+" is " +str(age)+" years old")
10th Aug 2021, 5:13 PM
Shadoff
Shadoff - avatar
+ 1
Md Ayaz How about this one? :- print(name, "is", age, "years old") # Hope this helps
10th Aug 2021, 6:38 PM
Calvin Thomas
Calvin Thomas - avatar
0
I'm stuck in identity card practice., and I don't know how to solve it.
10th Aug 2021, 5:10 PM
Zelda
Zelda - avatar
0
thank you
10th Aug 2021, 5:42 PM
Zelda
Zelda - avatar
- 2
did that too
10th Aug 2021, 5:17 PM
Zelda
Zelda - avatar