Reputation: 21
I just wrote my first program in python, but when I launch it on the IDLE the cursor immediately starts a line below my print() statement. Is there a way to set the cursor to start next to my print statement? Also I have noticed when I ran different programs that take user input, sometimes the cursors will appear above my print(). Is there any fixes to this?
Upvotes: 0
Views: 568
Reputation: 19144
When you prompt for input, you can put the prompt in the input call.
>>> name = input('What is your name? ')
What is your name? |
Upvotes: 1
Reputation: 354
print()
in Python, by default inserts a new line. In order to modify this behaviour, you have to explicitly call print with following args
print(string, end="")
Source:-
Upvotes: 0