Here I am trying to create a list of three fruits , Apple ,Pomegranate and Banana, and asking the user to select their favorite fruit. So I am defining a function print_choice that is called each time any checkbox is selected , and have defined an array fruits that appends the respective fruit to the array when the checkbox is
Tag: infinite-loop
Is it the right way to run 2 infiniteloop in python?
i wrote a code in python with 2 infinite loop like this: If i don’t join any thread it’s not working, but when i join 1 thread, another thread is work too but i don’t know why? Can anyone explain for me? Answer Join is used to block the calling method until the thread finishes, throws an exception or time
Python: vending machine
The program offers items, has the user pay for items, gives the items, and updates the stock of each item. It seems to work more or less. I have 2 questions: I don’t know how to exit the vending machine program after the user answers “n” to “buy something else? (y/n): “. Is there a way to make the code
How to stop an infinite loop safely in Python?
I’ve got a script that runs an infinite loop and adds things to a database and does things that I can’t just stop halfway through, so I can’t just press Ctrl+C and stop it. I want to be able to somehow stop a while loop, but let it finish it’s last iteration before it stops. Let me clarify: My code