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 Answers
+ 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