Skip to content
Sign upLog in
← Back to Community

HELP

Profile icon
Jaysc73LT1

I need some help with this repl it's supposed to be a choose your own adventure game, but the first question is mashed up when you play it. can someone help me?

Voters
Profile icon
Jaysc73LT1
Comments
hotnewtop
Profile icon
[deleted]

you could use

from time import sleep print ('welcome to my game!') sleep(3) # sleep is in seconds name = input ('what is your name? ')

or i dunno

Profile icon
Coder100

You have to print the text first before you do input due to a repl bug.

First, add this function to the top of the file:

def repl_inp(text = ''): print(text, end = '') return input()

And then you just treat that as your new input:

repl_inp("hi there")
Profile icon
Jaysc73LT1

@Coder100
so i put it at the top of the entire file or just the string that I am using for the input?

Profile icon
Brendan23

@Jaysc73LT1
I know I'm not coder100 but the answer to that question is you put the repl_inp function at the top of the whole file.

Profile icon
[deleted]

@Jaysc73LT1
you need to put it at the top, if you use the function before you declare it, there will be an error. Python is an interpreted language so it reads the code line by line when running. So python doesn't know about the function until it reaches the function when running

Profile icon
Coder100

at the top of the entire file, sorry about not clarifying.

Technically, you can put it wherever as long as it's before you use it

@Jaysc73LT1