xs7fbem
xs7fbem

Reputation: 3

how to make space between 2 string in python 3?

hi i want to ask if how i can put one line space in python 3. i use this code:

#def space():
#print()

but when i want to print it there is a "none" that prints for me but i want just a line with nothing i.e i want to type :

"hi how are you :

iam fine" 

i want to have the space between "hi how are you " and "iam fine" i give this to python3 :

print('hi how are you",space(),"iam fine")

but it will give me only:

 hi how are you None iam fine ..

what is the problem here? what dose this none means?

Upvotes: 0

Views: 5167

Answers (2)

Cameron Sparr
Cameron Sparr

Reputation: 3981

this is what you want:

def space():
    return '\n'

None is what it sounds like, it's printing None because you're not giving print() any inputs

Upvotes: 0

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799190

print() happens immediately. If you want a newline then you need to return '\n' instead.

Upvotes: 1

Related Questions