lundi 1 juillet 2019

Problems with a Python if-else statement

I am doing an assignment for an IT class. Very basic Python projects. I have no experience with it but am able to grasp what is going on most of the time. This project involves making choices involving random integer selections. I can get the options to work the way I want in the if-else format but the else command isn't responding the way I want. I have it up on repl.it. The section I am having issues with starts on line 130. The options all load properly but if the choice is 1-3 for some reason the program then prints the "else" statement after printing the "if" statements. This doesn't happen if they choose option 4 or pick an invalid number(the reason for the else statement).

https://repl.it/@MLirange/Adventure

(If you are running it in the console, to get to the second stage the key is either in option 1 or 2, then pick option 4. The second stage is where the if-else error is occurring.)

I didn't have this issue in the previous section of the program. I must have missed something, but I can't tell what it is. I should reiterate I am very much a beginner at this and am basically copy-pasting code as the assignment instructed, and then editing it to suit my needs.

Aucun commentaire:

Enregistrer un commentaire