dictionnaire2_mask.py

Created by huriel-mercier

Created on January 17, 2025

513 Bytes

Utilisé la fonction nsi2() en mettant le chiffre binaire “100000001” et cette fonction va seulement récupérer les 4 derniers bits, cette fonction permet d’utiliser un alphabet créer en binaire par moi et qui reprend les propriétés de la fonction mask.


from math import *
alphabet={"0001": "A","0011": "B",}

def nsi(i):
  if i=="0001":
    return alphabet["0001"] 
  if i=="0011":
    return alphabet["0011"]
    
def nsi2(i):
  if i=="100000001":
    binary_int=int(i,2)
    binary_str_i=bin(binary_int)
    print("0001=")
    return bin(binary_int & 0b1111)
  #if i==0b100000001: 
    #return i and 0b1111
#binary_str="000001111"
#binary_int=int(binary_str,2)
#print(binary_int)
#binary_str_again=bin(binary_int)
#print(binary_str_again)

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.