ascii.py

Created by danio

Created on April 20, 2020

555 Bytes


from ion import*

def go():
 print("1. Trouver le caractère")
 print("2. Trouver la valeur binaire")
 print()
 while True:
  x=1
  if keydown(KEY_ONE):
    while x==1:
      n=input("Valeur binaire : ")
      c=chr(int(n,2))
      print("Caractère ASCII :",c)
      print()
      if keydown(KEY_ANS):
        x=0
        go()
  if keydown(KEY_TWO):
    while x==1:
      c=input("Caractère ASCII : ")
      n=bin(ord(c)).lstrip("0b")
      print("Valeur binaire :",n)
      print()
      if keydown(KEY_ANS):
        x=0
        go()

go()

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.