# Type your text hereimport math
defcalculer_energie_cinetique(masse,vitesse):energie_cinetique=0.5*masse*vitesse**2returnenergie_cinetiquedefcalculer_energie_potentielle(masse,hauteur,acceleration_gravite=9.8):energie_potentielle=masse*acceleration_gravite*hauteurreturnenergie_potentielledefcalculer_energie_mecanique(energie_cinetique,energie_potentielle):energie_mecanique=energie_cinetique+energie_potentiellereturnenergie_mecaniquedefcalculer_travail_force(force,distance,angle=0):travail_force=force*distance*math.cos(math.radians(angle))returntravail_forcewhileTrue:print("Menu:")print("1. Calculer l'énergie cinétique")print("2. Calculer l'énergie potentielle")print("3. Calculer l'énergie mécanique")print("4. Calculer le travail de force")print("5. Quitter")choix=input("Entrez votre choix (1-5): ")ifchoix=="1":masse=float(input("Entrez la masse (en kg): "))vitesse=float(input("Entrez la vitesse (en m/s): "))energie_cinetique=calculer_energie_cinetique(masse,vitesse)print("L'énergie cinétique est de",energie_cinetique,"Joules.\n")elifchoix=="2":masse=float(input("Entrez la masse (en kg): "))hauteur=float(input("Entrez la hauteur (en m): "))energie_potentielle=calculer_energie_potentielle(masse,hauteur)print("L'énergie potentielle est de",energie_potentielle,"Joules.\n")elifchoix=="3":energie_cinetique=float(input("Entrez l'énergie cinétique (en J): "))energie_potentielle=float(input("Entrez l'énergie potentielle (en J): "))energie_mecanique=calculer_energie_mecanique(energie_cinetique,energie_potentielle)print("L'énergie mécanique est de",energie_mecanique,"Joules.\n")elifchoix=="4":force=float(input("Entrez la force (en N): "))distance=float(input("Entrez la distance (en m): "))angle=float(input("Entrez l'angle (en degrés, optionnel): "))travail_force=calculer_travail_force(force,distance,angle)print("Le travail de force est de",travail_force,"Joules.\n")elifchoix=="5":print("Au revoir !")breakelse:print("Choix invalide. Veuillez sélectionner un numéro valide.\n")
During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:
Ensure the proper functioning of the site (essential cookies); and
Track your browsing to send you personalized communications if you have created a professional account on the site and can be contacted (audience measurement cookies).
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.