I am relatively new to python, and I thought I understood the basics of it already, but for some reason, this one block of code is giving me so many problems. I cannot find the problem with this code, as it just keeps looping for seemingly no reason. What am I doing wrong here? I know this code can be optimized by the way, it was optimized but after it kept looping I thought I would take it back to the basics and that would fix it, but I was wrong.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
user_choice = "" run_loop = "run" while run_loop = = "run" : print () if user_choice.lower = = "option 1" : run_loop = "off" elif user_choice.lower = = "option 2" : run_loop = "off" elif user_choice.lower = = "option 3" : run_loop = "off" elif user_choice.lower = = "option 4" : run_loop = "off" elif user_choice.lower = = "option 5" : run_loop = "off" else : print ( "Here are your options:" ) user_choice = input ( "Option 1, Option 2, Option 3, Option 4, or Option 5: " ) |