Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make spaces between paragraphs in my Python script?

I'm making a game in Python (text only) but it gets confusing when people play it because there is no space between the paragraphs, so it looks like this:

'You step outside and feel the wind on your face.'
'Which direction do you turn?'

But I would like it to look like this:

'You step outside and feel the breeze on your face'

'What do you do next'?

Here's my code:

print 'You step outside and feel the cool breeze on your face.'
what = raw_input ('What do you do next ')

Thanks!

like image 732
Ryan Werner Avatar asked May 14 '26 20:05

Ryan Werner


2 Answers

Print a newline character.

print("\n")

Or:

print("An angry-looking dwarf throws an axe at you.\nYou die.\n")
like image 54
Li-aung Yip Avatar answered May 17 '26 09:05

Li-aung Yip


You have a few solutions:

The simpler one would be to use a print statement between your lines, which, used alone, prints a line feed.

Alternatively, you could you end the string you're printing with a '\n' character, which will cause a line feed, or you could start your input with the same character.

like image 21
Thomas Orozco Avatar answered May 17 '26 09:05

Thomas Orozco



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!