blondiefunk69
blondiefunk69

Reputation: 21

Cursor position in the IDLE

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?

enter image description here

Upvotes: 0

Views: 568

Answers (2)

Terry Jan Reedy
Terry Jan Reedy

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

onlinejudge95
onlinejudge95

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:-

  1. https://docs.python.org/3/library/functions.html#print

Upvotes: 0

Related Questions