Formatting Problems
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?
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()
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!
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.
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.
@robowolf I thought that initially too but I've made the window as wide as can be and still have the same issue
try using
\n
in yourinput
. Put it in a few places. and you'll be good to go.@RYANTADIPARTHI This worked! Thank you so much :)
@ConnorTruelove no problem :)