0
Can someone help me solving this. I don’t know how to give spaces.
name = input() age = input() print(name + “is” + age + “years old”.
3 Respuestas
+ 5
Hi Vikash!
There are many ways to give space between your input variables and strings in concatenation.
1. comma add a space by default in concatenation.
print(name ,"is" , age , "years old")
2. But you used "+" symbol here. In order to make a space for this type of concatenation, you can use the space inside quotes.
print(name + " is " +age+ " years old ")
FYI, you're supposed to use single(') or double(") quotes to denote a string.
0
Thanks a lot.
0
Vikashビカシヤ How about this one? :-
print(f"{input()} is {input()} years old.")
# Hope this helps