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”.

4th Aug 2021, 4:39 AM
Vikashビカシヤ
Vikashビカシヤ - avatar
3 odpowiedzi
+ 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.
4th Aug 2021, 4:53 AM
Python Learner
Python Learner - avatar
0
Thanks a lot.
4th Aug 2021, 4:55 AM
Vikashビカシヤ
Vikashビカシヤ - avatar
0
Vikashビカシヤ How about this one? :- print(f"{input()} is {input()} years old.") # Hope this helps
4th Aug 2021, 6:42 AM
Calvin Thomas
Calvin Thomas - avatar