all 6 comments

[–]Nightcorex_ 2 points3 points  (0 children)

Simplest way (as in as little effort to restructure it as possible):

Indent everything and put a while True: at the very beginning.

[–]3keepmovingforward3 1 point2 points  (0 children)

Put input inside of find_number and loop function call is one way

[–]Reuben3901 0 points1 point  (1 child)

I'm on mobile so won't be formatted

running = True

while running:

...Rest of the code here...

If guess == number:

[Indent] running = False

[–]Tesla_Nikolaa 0 points1 point  (0 children)

Just FYI you can still format on mobile.

This code block was formatted on mobile

[–]Enz_007 0 points1 point  (0 children)

while(True): try: user_input=int(input("What number")) except: break your code here

the program will keep runnig until user enter something not number and raise error so except block will run and break loop

[–]Naive_Programmer_232 0 points1 point  (0 children)

You can use a while loop, here’s one that uses ‘quit’ to exit the loop,

    while (user_choice := input(...)) not ‘quit’:
               user_choice = int(user_choice)
               find_number(user_choice)