eq_cercle_sphere.py

Created by danio

Created on December 20, 2019

980 Bytes

Donne le périmètre et l’aire d’un cercle. Donne la surface et le volume d’une sphère.


from math import*
print("Rentre 1, 2, 3 ou 4 :")
print("1: Périmètre d'un cercle")
print("2: Aire d'un cercle")
print("3: Surface d'une sphère")
print("4: Volume d'une sphère")
z=1
while z<10:
  print()
  n=int(input("-> "))
  if n==0:
    print("- Périmètre : 2 * pi * r")
    print("- Aire : pi * r^2")
    print("- Surface : 4 * pi * r^2")
    print("- Volume : 4/3 * pi * r^3")
  if n==1:
    r=float(input("Rentre le rayon : "))
    p=2*pi*r
    print("Périmètre =",p)
  if n==2:
    r=float(input("Rentre le rayon : "))
    a=pi*r**2
    print("Aire =",a)
  if n==3:
    r=float(input("Rentre le rayon : "))
    s=4*pi*r**2
    print("Surface =",s)
  if n==4:
    r=float(input("Rentre le rayon : "))
    v=4/3*pi*r**3
    print("Volume =",v)
  if n<0 or n>4:
    print("Rentre 1, 2, 3 ou 4 :")
    print("1: Périmètre d'un cercle")
    print("2: Aire d'un cercle")
    print("3: Surface d'une sphère")
    print("4: Volume d'une sphère")

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.