Brian
Brian

Reputation: 151

ask for input then skip line after

x = float(input("Please enter x value: "))
print("random next line")

I want the end result to look like

Please enter x value: 5

random next line

how can I skip a line after asking for user input, but not put the user input on the next line without adding a

print("")

Upvotes: 0

Views: 2527

Answers (4)

djupp
djupp

Reputation: 1

How about:

x = float(input("Please enter x value: "))
print('\n' + your_next_line)

That way, you can pass whatever string you want and simply concatenate the \n newline in front of it.

Upvotes: 0

mhlester
mhlester

Reputation: 23231

you have two choices. either print("") before the next line, or print("\nrandom next line")

Upvotes: 0

MattDMo
MattDMo

Reputation: 102862

x = float(input("Please enter x value: "))
print("\nrandom next line")

will print a newline character (\n) first, giving you a blank line.

Upvotes: 1

praveen
praveen

Reputation: 3263

x = float(input("Please enter x value: "))
print
print("random next line")

Upvotes: 0

Related Questions