twitter.py

Created by schraf

Created on June 13, 2022

310 Bytes

Lancez ce script sur une vraie machine. La calculatrice attend un appui sur un chiffre impair (1,3,5,7 ou 9) puis sur 2 ou 8 et à nouveau un nombre impair, etc.

La formule (1 + (k + 3) % 9) * (k < 48) permet de transformer les codes des touches en chiffres : 42 -> 1, 44 -> 3 etc


from ion import keydown

def chiffres(*dg): 
 while True:
  for k in dg:
   if keydown(k):
    while keydown(k): continue
    return (1 + (k + 3) % 9) * (k < 48) 
    
    
while True:
  # on attend un chiffre impair
  print(chiffres(42,44,37,30,32))
  # puis 2 ou 8
  print(chiffres(43,31))