# -*- coding: utf-8 -*-
#"====================
# Mesure agraire
# from math import sqrt
# from math import floor
#-----------------------------déclaration des variables
global choix
global quantité
global inter
global millimètre
global centimètre
global décimètre
global mètre
global décamètre
global hectomètre
global kilomètre

choix = 0
nombre = 0.0
inter = 0.0
millimètre = 0.0
centimètre = 0.0
décimètre = 0.0
mètre = 0.0
décamètre = 0.0 
hectomètre = 0.0
kilomètre = 0.0
#-----------------------------choix de l'unité de départ
def question() :
    global choix
    
    print()
    print("millimètre²..............= 1")
    print("centimètre²..............= 2")
    print("décimètre²...............= 3")
    print("Mètre² ou centiare.......= 4")
    print("Décamètre² ou Are........= 5")
    print("Hectomètre² ou Hectare...= 6")
    print("Kilomètre²...............= 7")
    print()
    choix = input("taper le chiffre de votre choix ")
    try :
        choix = int(choix)
    except :
        print("Vous devez taper uniquement un chiffres, rien d'autre.")
        print()
        question() # tourniquet pour réponse non conforme
        
    if choix < 1 :
        print("Ce chiffre est trop petit !")
        print()
        question() # tourniquet pour réponse non conforme
    
    if choix > 7 :
        print("Ce chiffre est trop grand !")
        print()
        question() # tourniquet pour réponse non conforme
    return
#-----------------------------nombre pour le calcul
def nombre() :
    global nombre
    
    print()
    nombre = input("taper la valeur à calculer ")
    try :
        nombre = float(nombre)
    except :
        print("Vous devez ne taper que des chiffres, ni lettre ni espace.")
        print()
        nombre() # tourniquet pour réponse non conforme
    return
#-----------------------------réduction en mètre²
def récuction() :
    global choix
    global inter
    global nombre
    
    if choix == 1 :
        inter = nombre / 1000000
    if choix == 2 :
        inter = nombre / 10000
    if choix == 3 :
        inter = nombre / 100
    if choix == 4 :
        inter = nombre
    if choix == 5 :
        inter = nombre * 100
    if choix == 6 :
        inter = nombre * 10000
    if choix == 7 :
        inter = nombre * 1000000
    return
#-----------------------------section calcul
def calcul() :
    global inter
    global millimètre
    global centimètre
    global décimètre
    global mètre
    global décamètre
    global hectomètre
    global kilomètre
    
    millimètre = inter * 1000000
    centimètre = inter * 10000
    décimètre = inter * 100
    mètre = inter 
    décamètre = inter * 0.01
    hectomètre = inter * 0.0001
    kilomètre = inter * 0.000001
    return
#-----------------------------arrondir
def arrondir() :
    global millimètre
    global centimètre
    global décimètre
    global mètre
    global décamètre
    global hectomètre
    global kilomètre

    millimètre = round(millimètre, 13)
    centimètre = round(centimètre, 13)
    décimètre = round(décimètre, 13)
    mètre = round(mètre, 13)
    décamètre = round(décamètre, 13)
    hectomètre = round(hectomètre, 13)
    kilomètre = round(kilomètre, 13)
    return
#-----------------------------[main programme]
print("choisir le chiffre de l'unité désiré") 
question()
nombre()
récuction()
calcul()
arrondir()
#-----------------------------section impression
print()
print("millimètre²..............=", millimètre)
print("centimètre²..............=", centimètre)
print("décimètre²...............=", décimètre)
print("Mètre² ou centiare.......=", mètre)
print("Décamètre² ou Are........=", décamètre)
print("Hectomètre² ou Hectare...=", hectomètre) 
print("Kilomètre²...............=", kilomètre)
#-----------------------------------------------------------------------------------Sortie
print()
print("----------------------")
bye = (input ("Entrer pour Sortir...!"))

    
    
    
    
    
    