wklejamy.pl website for sale. You are interested in. Please contact. wklejamy@gmail.com
Click to buy coffe
Untitled
Guest 53 12th Mar, 2023
''''Tomasz Kostrzewa id_62 Odgadywanie liczby naturalnej<100'''
x,y,z = 1,99,50
print('AI: Pomyśl liczbę naturalną < 100, a ja ją odgadnę.',
'\nPodam Ci liczbę, a Ty odpowiedz kodem:',
'\nza dużo - 3; za mało - 1; zgadłem - 2')
res = int(input(str(z)+' > '))
while res not in (1,2,3):
res = int(input('? >'))
while res != 2 and x <= y:
if res == 1: x = z+1
else: y = z-1
z = ( x + y) // 2
res = int(input(str(z) + ' > '))
while res not in (1, 2, 3):
res = int(input('? >'))
if res == 2: print('Zgadlem! To ', z)
else: print('Przedzial jest pusty!')
To share this paste please copy this url and send to your friends
RAW Paste Data