Can someone help me solving this. I don’t know how to give spaces. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 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.
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