Run skips my main.py file

When i press run, it doesn’t print my main.py file stuff, it skips to my ‘guess the number’ file. I can’t see a flaw in my code though, any tips?

https://replit.com/@MalcolmMoore3/game-compendium#main.py

It runs main.py for me.
image

1 Like

yeah, sorry, i decided to just scrap the multiple files because it just wasn’t working, and a bit too hard for my skill level. I figured out though that importing the other python files is what was causing it, so would the best option be to import the file after the ‘playerchoice’ input?

You can can (and should) import other Python files just like you would anything else. So if you had two files, main.py and other.py, you’d do something like this:

# other.py
def fun(phrase):
  return input(phrase)
# main.py
from other import fun
print(fun())

Always put your imports at the beginning of your code.

1 Like

I just gained another problem, which wasn’t a problem before. Whenever I input rps, it plays rock paper scissors (as it should), but then when i input gtn, or je, it plays rock paper scissors too, even though the code isn’t telling it to respond that way (i think).

1 Like

image
I don’t think this is valid Python syntax, which may be causing the issue. Try one of the following:

if playerchoice.lower() == "rock paper scissors" or playerchoice.lower() == "rps" or playerchoice.lower() == "1":
if playerchoice.lower() in ["rock paper scissors", "rps", "1"]:
# I'd go with this one ^
2 Likes