pythagore.py

Created by kmaulet5

Created on February 18, 2024

1.81 KB


from math import *
def tp(Nom_rectangle, sommet_triangle):
    hyp_name = str(input("le nom de l'hypothénus?"))
    hyp_value = int(input("la valeur de l'hypothénuse? si l'hypotenus est inconu alors marqué [00]"))
    
    coad_name = str(input("le nom du coté adjacent?"))
    coad_value = int(input("la valeur du coté adjacent? si ce coté est inconu alors marqué [00]"))
    
    coop_name = str(input("le nom du coté opposé?"))
    coop_value = int(input("la valeur du coté opposé? si ce coté est inconu alors marqué [00]"))
    
    print("Ce triangle", Nom_rectangle," est rectangle en", sommet_triangle)
    print("D'après le théorème de Pythagore:") 
    
    if hyp_value == 00:
        print(hyp_name,"2", "=", coad_name,"2","+", coop_name,"2")
        print(hyp_name,"2", "=", coad_value,"2","+", coop_value,"2")
        #print(hyp_name,"2", "=", coad_value**2,"+", coop_value**2)
        print(hyp_name,"2", "=", coad_value**2 + coop_value**2)
        somme = coad_value**2 + coop_value**2
        print(hyp_name, "=",sqrt(somme))
        
    if coad_value == 00:
        print(coad_name,"2", "=", hyp_name,"2","-", coop_name,"2")
        print(coad_name,"2", "=", hyp_value,"2","-", coop_value,"2")
        #print(coad_name,"2", "=", hyp_value**2,"-", coop_value**2)
        print(coad_name,"2", "=", hyp_value**2 - coop_value**2)
        somme = hyp_value**2 - coop_value**2
        print(coad_name, "=",sqrt(somme))
        
    if coop_value == 00:
        print(coop_name,"2", "=", hyp_name,"2","-", coad_name,"2")
        print(coop_name,"2", "=", hyp_value,"2","-", coad_value,"2")
        #print(coop_name,"2", "=", hyp_value**2,"-", coad_value**2)
        print(coop_name,"2", "=", hyp_value**2 - coad_value**2)
        somme = hyp_value**2 - coad_value**2
        print(coop_name, "=",sqrt(somme))

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.