# -*- coding: utf-8 -*-
#======================

#-----------------------------------------------------questions
print()
print("     --Choisir le chiffre de l'unité de départ-- ")
print("     --------------------------------------------")
print("     Celsius......: 1            Delisle......: 6")
print("     Kelvin.......: 2            Leyden.......: 7")
print("     Fahrenheit...: 3            Romer........: 8")
print("     Réaumur......: 4            Newton.......: 9")
print("     Rankine......: 5            -------------:  ")
print("     --------------------------------------------")
#-----------------------------------------------------choix pour le calcul
def choisir() :
    global choix
    
    print()
    choix = input("      Entrez le numéro de l'option choisie : ")
#    print()
    try :
        choix = int(choix)
    except :
        print(" Vous devez taper uniquement un chiffre, rien d'autre")
        choisir() # tourniquet pour chiffre non conforme
    
    if choix < 0 :
        print("          Erreur ce chiffre est négatif !")
        choisir()  # tourniquet pour chiffre négatif
        print()
        
    if choix == 0 :
        print("       Erreur se chiffre est trop petit !")
        choisir()  # tourniquet pour chiffre trop petit
        print()
    
    if choix > 9 :
        print("       Erreur se chiffre est trop grand !")    
        choisir()  # tourniquet pour chiffre trop grand
        print()
    
    return
#-----------------------------------------------------température de départ
def nmbre() :
    global nombre
    
    nombre = input(" Entrer la température de départ pour le calcul : ")
    print()
    try :
        nombre = float(nombre)
    except :
        print(" Vous devez taper uniquement un nombre, rien d'autre")
        nmbr() # tourniquet pour chiffre non conforme
    
    return
#-----------------------------------------------------ramener tout en Celcius
def cel() :
    global celsius
    global Kelvin
    global fahrenheit
    global réaumur
    global rankine
    global delisle
    global leyden
    global romer
    global newton
    
    if choix == 1 :
        celsius = nombre                          # Celsius
    
    if choix == 2 :
        celsius = nombre - 273.15                 # Kelvin
    
    if choix == 3 :
        celsius = (nombre - 32.0) * 5.0 / 9.0     # Fahrenheit
    
    if choix == 4 :
        celsius = nombre / 0.80                   # Réaumur
    
    if choix == 5 :
        celsius = (nombre - 491.67) * 5.0 / 9.0   # Rankine
    
    if choix == 6 :
        celsius = (nombre + 100.0) / 1.5          # Delisle
    
    if choix == 7 :
        celsius = nombre - 253.0                  # Leyden
    
    if choix == 8 :
        celsius = (nombre - 7.5) / 0.525          # Romer
    
    if choix == 9 :
        celsius = nombre / 0.33                   # Newton
    
    return
#-----------------------------------------------------calcul
def calc() :
    global celsius
    global kelvin
    global fahrenheit
    global réaumur
    global rankine
    global delisle
    global leyden
    global romer
    global newton
    
#   celcius = celsius
    kelvin = celsius + 273.15
    fahrenheit = (celsius * 9.0 / 5.0) + 32.0
    réaumur = celsius * 0.8
    rankine = celsius * 9.0 / 5.0 + 491.67
    delisle = (celsius * 1.5) - 100.0
    leyden = celsius + 253.0
    romer = celsius * 0.525 + 7.5
    newton = celsius * 0.33
    
    return
#-----------------------------------------------------arrondir
def arrondi() :
    global celsius
    global kelvin
    global fahrenheit
    global réaumur
    global rankine
    global delisle
    global leyden
    global romer
    global newton
    
    celsius = round(celsius, 3)
    kelvin = round(kelvin, 3)
    fahrenheit = round(fahrenheit, 3)
    réaumur = round(réaumur, 3)
    rankine = round(rankine, 3)
    delisle = round(delisle, 3)
    leyden = round(leyden, 3)
    romer = round(romer, 3)
    newton = round(newton, 3)
    
    return
#-----------------------------------------------------déclaration des variables globales
global celsius
global kelvin
global fahrenheit
global réaumur
global rankine
global delisle
global leyden
global romer
global newton
#-----------------------------------------------------initialisation des variables
celsius = 0.0
kelvin = 0.0
fahrenheit = 0.0 
réaumur = 0.0
rankine = 0.0
delisle = 0.0
leyden = 0.0
romer = 0.0
newton = 0.0
#-----------------------------------------------------[main]
choisir()
nmbre()
cel()
calc()
arrondi()
#-----------------------------------------------------impression
print()
print("     Celsius......= ", celsius)
print("     Kelvin.......= ", kelvin)
print("     Fahrenheit...= ", fahrenheit)
print("     Réaumur......= ", réaumur)
print("     Rankine......= ", rankine)
print("     Delisle......= ", delisle)
print("     Leyden.......= ", leyden)
print("     Romer........= ", romer)
print("     Newton.......= ", newton)
print()
#-----------------------------------------------------Sortie
print()
print("    -----------------------")
bye = ( input("    Entrer pour Sortir...!"))
