Math Noob
Math Noob

Reputation: 35

New line after input

I would like to have the following output:

Type in something random:
2

I used the following code:

input("Type in something random:")

and my output is

Type in something random:2

(Output for when the user inputs "2")

How can I have the output given to me in a new line, as demonstrated above?

I am using Python 3.

Upvotes: 2

Views: 3573

Answers (3)

learner1001
learner1001

Reputation: 31

Try adding \n

print("Type in something random: \n2") 

Type in something random: 
2

Upvotes: 3

Try to add a new line character as below

input("Type in something random: \n")

so that you will get output like this

Type in something random:
6
'6'

Upvotes: 3

Zephyr
Zephyr

Reputation: 12524

Just add a \n (new line character) to the end of the string, like this:

input("Type in something random:\n")

Upvotes: 3

Related Questions