- 3
how to get the output James is 42 years old
name="James" age="42"
8 ответов
+ 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
+ 2
Where is your attempt and language information?
+ 2
print("James + " is "+" 42"+ " years old")
+ 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")
+ 1
Md Ayaz How about this one? :-
print(name, "is", age, "years old")
# Hope this helps
0
I'm stuck in identity card practice., and I don't know how to solve it.
0
thank you
- 2
did that too