i want to end the while True
loop if num4 == number
but break stops the loop from repeating and not making the if statement
a part of the while True
loop makes the code inaccessible.
the code is below:
number = 50
count = 0
num4 = int(input("Enter a number: "))
while True:
if num4 > number:
print("Too high")
num4 = int(input("Try again: "))
elif num4 < number:
print("Too low")
num4 = int(input("Try again: "))
elif num4 == number:
print("Well done, you took", count, "attempts")