from math import * from random import * from kandinsky import * from ion import * from time import * fill_rect(0,0,322,222,"black") draw_string(""" There are only 10 kinds of people in this world: Those who understand binary, and those who don't. Which one will you become? """,20,40,choice(["white","orange","cyan"]),"black") sleep(0.2) while not keydown(KEY_OK) and not keydown(KEY_EXE) : draw_string("Press OK to Begin",115,200,"white","black") restart=True loop=True font=choice(["green","white","gray","cyan"]) fill_rect(0,0,322,222,"black") while loop: fill_rect(0,20,322,2,"gray") fill_rect(0,55,322,2,"gray") mylist=[] for n in range(40,40+12*9,14): sleep(0.1) bit=choice([0,1]) draw_string(str(bit),n,30,font,"black") mylist.append(bit) decimal=mylist[-1]*1+mylist[-2]*2+mylist[-3]*4+mylist[-4]*8+mylist[-5]*16+mylist[-6]*32+mylist[-7]*64+mylist[-8]*128 while not keydown(KEY_OK): draw_string(str(mylist),30,90,"gray","black") draw_string(str("= "+str(decimal)),165,30,"white","black") draw_string("Standard Format: "+str(bin(decimal)),25,130,"white",(15,25,45)) if int(decimal)%2==1: draw_string("Number: Odd ",32,160,"gray","black") else: draw_string("Number: Even",32,160,"green","black") draw_string("Press OK to restart",115,200,"cyan","black") font=choice(["cyan","green","white","gray"]) fill_rect(0,0,322,222,"black")