+ 1

How can I give space between them

My input is : name = "James" age = '42' print (name + "is" + age + 'years' + 'old') And output is Jamesis42yearsold But the expected is James is 42 years old

2nd Feb 2021, 11:51 PM
Horilal S Nirmalkar
Horilal S Nirmalkar - avatar
2 Réponses
+ 5
you could just pass arguments to the print function (default separator sep=" "): print(name,"is",age,"years old") obviously, string could contains spaces (only one literal string at last argument above): print(name+" is "+age+" years old")
2nd Feb 2021, 11:58 PM
visph
visph - avatar
+ 2
Thank You so much ❤️😊 Jan
2nd Feb 2021, 11:56 PM
Horilal S Nirmalkar
Horilal S Nirmalkar - avatar