0
How do I exit a while loop upon user input?
I have a dice rolling game and everything is working properly except for the fact that i cant exit the while loop with the user input i wrote in the program
2 Answers
+ 2
You can use the break statement for that. Add this to then end of your code.
if user_input == "exit":
break
- 1
https://code.sololearn.com/cZ8yrUM7b19a/?ref=app
somehow it becomes an infinite loop