Improve my core loop

I'm getting back into python programming after a very long hiatus. As an exercise I decided to write a program to solve the daily Wordle.

I'm not happy with my main program loop. It asks the user for the result of its latest guess. If the answer is all greens (ggggg) then we're done, otherwise get a new guess using my function new_guess.

It works, but it seems clunky in the extreme. I'm wondering if anyone would be willing to offer constructive criticism on how to improve the logic. If not, roast it to flames and call me names; I can take it.

(Yes, there's zero error-checking on the input. I can work on that. I'm mostly interested in how I can improve the overall loop.)

# First guess will be 'dealt'
guess = 'dealt'
found_solution = False
# Get the result from testing our guess and generate a new guess
while found_solution == False:
    print(guess)
    result = input("Result: ")
    if result == 'ggggg':
        found_solution = True
    else:
        guess = new_guess(guess, result)

Posted May 4, 2022, 6:35 PM UTC · edited

010
Loading comments…