Ask coding questions

← Back to all posts
Text in Console Different Than Code
MisterMr (1)

Can you explain why this is happening and how to fix this?

Answered by Coder100 (18109) [earned 5 cycles]
View Answer
Coder100 (18109)

It is called line wrapping.
If the text is too long, the text wraps, regardless of word.

But the input function is also pretty glitchy, here is a fixed version:

def input_bettr(p = ''):
  print(p, end = '', flush = True)
  return input('')
MisterMr (1)

@Coder100 thank you. ill try it out

MisterMr (1)

@MisterMr It worked! Thank you!

MisterMr (1)

@MisterMr Actually it didn't work. It worked at first but then it glitches and line wraps again.

Coder100 (18109)

@MisterMr well yeah
you never even used my function

Coder100 (18109)

what you are supposed to do is something like this:

var = input_bettr("hello world aoeuaoeunaeohus aheontuhaoeuo")


MisterMr (1)

It works but when you press backspace, it deletes the line

MisterMr (1)

@MisterMr Wait i fixed it

thank you