pythoninputoutputnewline

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.


Solution

  • 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'