I wrote this code for a reverse guessing game but it prints c twice for the first time. Keep in mind (d=correct) (b=bigger) (k=smaller).
import random
c = random.randint(1,99)
print(c)
a = str(input())
while a != "d":
if a == "b":
print(c)
c = random.randint(c,99)
a = str(input())
elif a == "k":
print(c)
c = random.randint(1,c)
a = str(input())
elif a == "d":
break
The output is like this:
67
b
67
I want 67 to be printed once.
I tried removing print(c)
in lines 3, 7, 11.
If you don't want to print c two times, simply try adding the print statement after generating the new random number as you did the first time.