How to add space in begginer python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

How to add space in begginer python

I want to do a challenge for beginner python course and one of the challenges is to print a name and age name= "John" age= "24" print (name + 'is' + age 'years old') and the output is: Johnis24years old how can i add space between john , is , 24 and years?

25th Apr 2021, 9:43 PM
Mwsdo - avatar
2 Answers
+ 2
use 2 spaces before and after " is " and 1 space before " years." Like this print(name+" is "+age+" years")
25th Apr 2021, 9:48 PM
TOLUENE - avatar
Use the space in double quote like ...+ " is " + ...+ " years old " And, If you need to make new line, use this: print("\n")
23rd Sep 2021, 1:12 AM
Sarmad Saad
Sarmad Saad - avatar