You are on page 1of 1

ΑΛΓΟΡΙΘΜΟΣ ΠΑΙΧΝΙΔΙΟΥ «ΜΑΝΤΕΨΕ ΤΟΝ ΑΡΙΘΜΟ»

(για την κατανόηση της δυαδικής αναζήτησης)

#encoding:utf-8
import random

x = random.randint(1,100)

vrethike = False

while not vrethike:


g = input("ΜΑΝΤΕΨΕ ΚΑΙ ΔΩΣΕ ΤΟΝ ΑΡΙΘΜΟ -->")

if x == g:
print "ΤΟ ΒΡΗΚΕΣ"
vrethike = True
elif x < g:
print "ΜΙΚΡΟΤΕΡΟΣ Ο ΑΡΙΘΜΟΣ ΠΟΥ ΨΑΧΝΕΙΣ"
else:
print "ΜΕΓΑΛΥΤΕΡΟΣ Ο ΑΡΙΘΜΟΣ ΠΟΥ ΨΑΧΝΕΙΣ"

You might also like