magie64.py

Created by cent20

Created on January 11, 2020

671 Bytes

===== Tour de magie n°64 par cent20 =====
NSI : Puissance de 2 !


# BETA avant Offuscation
# DEV encours

print("Choisis un nombre \n entre 0 et 63")

print("Des listes vont s'afficher \nsi ton nombre est \ndans la liste répond OUI \n sinon répond NON")
OUI = ["OUI", "oui", "Oui", "O","o", "1", 1]
input()

listes = []

for i in range(0,6):
    listes.append([])
    m=n=2**i
    while n<64:
        listes[i].append(n)
        n +=1*((n+1)%m!=0)+(m+1)*((n+1)%m==0)

s = 0

for i in range(6):
    for j in range(len(listes[i])):
        print("0"*(listes[i][j]<10)+str(listes[i][j])," ",end="\n"*((j+1)%7==0))
    print("")
    reponse = input()
    if reponse in OUI:
        s +=2**i
print("réponse =",s)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.