How do you add spaces between words output in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do you add spaces between words output in python?

everything i've seen shows adding whitespaces

26th Nov 2021, 8:48 PM
Keefer
Keefer - avatar
3 Answers
+ 8
Keefer , if you are using variables and strings with the print() function, you can separate them by comma. this inserts a space. first_name = "Paul" last_name = " Simon" print("My name is", first_name, last_name) result: My name is Paul Simon
26th Nov 2021, 9:07 PM
Lothar
Lothar - avatar
+ 5
Try this: name=input() print("Hello "+name) print("Hello",name) print(f'Hello {name}')
26th Nov 2021, 9:08 PM
Abdulaziz Al-Shehhi
Abdulaziz Al-Shehhi - avatar