My goal here is to have the user choose between 3 options and if they don't it shows an error message and keeps them in the loop

Advertisements The top 3 lines just generates 3 random pokemon names. The issue comes in the "If" statement as when the user inputs something that is not an option, it passes the if statement, but because it wasn’t an option, the user is still stuck in the while loop. def pkmn_choice1(): Pokemon1 = Pokemon_dct[f'{random_pkmn1}’].pokechoice() Pokemon2… Read More My goal here is to have the user choose between 3 options and if they don't it shows an error message and keeps them in the loop

Why does my while loop break at end even when I make sure my game_start variable is still 0?

Advertisements I’ve tried adding breaks and continues in multiple formats such as if/else structures and also just adding the break and continues right after and no matter how I structured it nothing worked. I’m not getting an error code but it is breaking out of the while loop even if x is inputted as 0… Read More Why does my while loop break at end even when I make sure my game_start variable is still 0?

Why does the output differ when using a semicolon at the end of a "while" statement vs at the end of a "for" statement?

Advertisements When reviewing while and for loops, I encountered a couple of loops that would iterate a variable, i, then print it. I am aware of the semicolon giving the while loop an empty body, but does it work the same in for loops? For example, if I use a semicolon after the for statement… Read More Why does the output differ when using a semicolon at the end of a "while" statement vs at the end of a "for" statement?