base_convert_compressed.py

Created by toronico07

Created on April 30, 2022

1.15 KB


print("Bonjour. Bienvenue dans base_convert.py créer par nt games !\n")
activer = True
while activer == True:
    print("Choisis ce que tu veux convertir :")
    print("1 - Base 10 en binaire")
    print("2 - Binaire en base 10")
    print("3 - Base 10 en hexadécimal")
    print("4 - Hexadécimal en base 10")
    print("5 - N'importe quelle base en base 10")
    choix = str(input("Choix : "))
    print()
    if choix == "1":
        nombre = int(input("Nombre : "))
        print(bin(nombre)[2:])
    elif choix == "2":
        binaire = input("Binaire : ")
        print(int(binaire, 2))
    elif choix == "3":
        nombre = int(input("Nombre : "))
        print(hex(nombre)[2:])
    elif choix == "4":
        hexadecimal = input("Hexadecimal : ")
        print(int(hexadecimal, 16))
    elif choix == "5":
        base = int(input("Base : "))
        nombre = input("Nombre : ")
        print(int(nombre, base))
    else:
        print("Choix inconnu !")
    print("\nVeux-tu continuer ?")
    print("1 - Oui")
    print("2 - Non")
    continuer = str(input("Choix : "))
    if continuer == "1":
        print()
    else:
        exit()

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.