+ 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
2 odpowiedzi
+ 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")
+ 2
Thank You so much ❤️😊 Jan