Untitled

mail@pastecode.io avatar
unknown
plain_text
15 days ago
400 B
2
Indexable
Never
import random
input("Think of a number between 0 and 100. Press enter when ready.")
upperBound=100
response=0
lowerBound=0
while response!="yes":
    guess=round((upperBound+lowerBound)/2)
    response= input(str(f"Is it {guess}? If it's not {guess}, is it higher or lower?: "))
    if response=="lower":
        upperBound=guess
    elif response=="higher":
        lowerBound=guess


Leave a Comment