0

Spacing between addition of string variables in Python

Please! I need help here. How can I add spacing to a sample code like this?: firstname = str(input ()) lastname = str(input ()) print (firstname + lastname) For the sample Python code I wrote above, how can I have my output in (firstname lastname), and not (firstnamelastname)?

1st Sep 2021, 10:12 PM
Oduse David Oluwadamilola
Oduse David Oluwadamilola - avatar
5 Respostas
+ 5
print(firstname + " " + lastname) or print(firstname, lastname)
1st Sep 2021, 10:19 PM
Simon Sauter
Simon Sauter - avatar
+ 4
Use , instead of + and it will add spaces between them.
1st Sep 2021, 10:18 PM
Abhay
Abhay - avatar
+ 4
Simon Sauter ty ! But i don't care for the downvotes as long as the op finds my answer helpful .
1st Sep 2021, 10:29 PM
Abhay
Abhay - avatar
+ 1
Abhay Simon Sauter Thanks for the help, bosses! I can proceed with the code here ☺️
1st Sep 2021, 10:36 PM
Oduse David Oluwadamilola
Oduse David Oluwadamilola - avatar
0
Why would anyone down vote Abhay ''s answer? It's absolutely correct.
1st Sep 2021, 10:23 PM
Simon Sauter
Simon Sauter - avatar