Skip to content
← Back to Community
Formatting Problems
Profile icon
ConnorTruelove

Hey,

This is my first day using python and I've been following along with a youtube video to try and learn. I've copied the code exactly but as you can see the formatting of the last line in the shell has gone really weird and displaying text out of order and missing out some of it.

Any help as to why this is?
weird formatting

Answered by RYANTADIPARTHI [earned 5 cycles]
View Answer
Voters
Profile icon
InariiSage
Profile icon
ConnorTruelove
Comments
hotnewtop
Profile icon
RYANTADIPARTHI

try using \n in your input. Put it in a few places. and you'll be good to go.

Profile icon
ConnorTruelove

@RYANTADIPARTHI This worked! Thank you so much :)

Profile icon
RYANTADIPARTHI

@ConnorTruelove no problem :)

Profile icon
GeorgPlaz

Use these definitions to keep your code working even on non-replit systems:

# reference to original print and input functions real_print = print real_input = input # fix replit print function def print(text, end="\n"): lines = text.splitlines() if len(lines) > 0: for line in lines[:-1]: real_print(line) real_print(lines[-1], end=end) else: real_print("", end=end) # fix replit input function def input(prompt=""): print(prompt, "") return real_input()
Profile icon
Coder100

input is very very very buggy on replit.

Please, use this function instead:

def _input(text='') print(text, end='') return input()

Add it to the TOP of the file.

so when they do a input(), actually type in _input(). Thanks!

Profile icon
sylashur

The tutorial may have a place to copy the basic code from with no page formatting, if not, you'll have to manually fix the code.

Profile icon
robowolf

Well the indentations are from the pasted code. The code going on multiple lines is just due to the size of the window. You can change that by adjusting the line between the output window and input window.

Profile icon
ConnorTruelove

@robowolf I thought that initially too but I've made the window as wide as can be and still have the same issue