0

When I run the code in PyCharm, I get exit code 0, so I know the file is compiling properly. What I don't understand is why it's not displaying anything.

I have it set up to take input and output an appropriate response based on that input, but neither CMD or PyCharm are displaying anything when I run the file. Debugging didn't throw an error, so as far as I can tell, the code itself is properly written.

Did I miss something? Am I not invoking the function properly?

def wthGen(weather):
    # after generating, defines the weather states
    for weather in range(0, 5):
        x = 0
        if weather == 0:
            print("It's a beautiful day.")
        if weather != 0:
            x += 1
            if x == 1:
                print("There's a light rain; bring a coat! ")
            elif x == 2:
                print("The air is thick with fog. Perception debuffs apply.")
            elif x == 3:
                print("The rain beats down without remorse. Perception debuffs apply +1")
            elif x == 4:
                print("The snow nips at your fingers. Dexterity debuffs apply.")
            elif x == 5:
                print("The wind rages against you with all its fury. Strength debuffs apply.")

# calls wthGen to determine weather state
def main(wthGen):
    w = int(input("Enter a number from 0 to 5 to determine appropriate debuffs based on weather conditions: "))
    print(wthGen[0,5](w))

main()
nintyo
  • 1
  • 2
  • Are you getting the "Enter a number" prompt? Or nothing at all, not even that? – John Kugelman Feb 06 '21 at 08:06
  • `if w == True` isn't right. You're asking them to enter a number between 0 and 5, so checking against `True` won't work. (See [How can I read inputs as numbers?](https://stackoverflow.com/questions/20449427/how-can-i-read-inputs-as-numbers).) – John Kugelman Feb 06 '21 at 08:08
  • I got rid of the if w== True segment, and tried switching w to an int(input), as well as converting wthGen to a matrix, which seems like progress but isn't necessarily solving it. PyCharm is telling me that wthGen is unfilled when I evoke main(). Any other ideas? I appreciate the help either way. If we can't figure out the issue, I'll probably just rewrite it altogether. – nintyo Feb 06 '21 at 16:52
  • 1
    Edit this question, or post a new one with the new code. – John Kugelman Feb 06 '21 at 17:38
  • 1
    Please [edit] your question or post a new one. Comments can't handle multiple lines of code. – John Kugelman Feb 06 '21 at 19:43
  • My bad, I'm not very used to this site yet. I updated the question. – nintyo Feb 06 '21 at 20:20

0 Answers0