39 lines
798 B
Python
39 lines
798 B
Python
|
#!/usr/bin/env python
|
||
|
|
||
|
from math import pi
|
||
|
|
||
|
def volume_sphere(rayon):
|
||
|
return (4/3)*pi*rayon**3
|
||
|
|
||
|
def prix_livre(nbr, prix):
|
||
|
return ((prix*nbr) - (prix*nbr*(40/100)) + (3 + 0.75*(prix - 1)))
|
||
|
|
||
|
def time_per_miles(km, h, m, s):
|
||
|
mi = km / 1.61 # km to mi
|
||
|
total_sec = h *60 + m * 60 + s
|
||
|
return mi / total_sec
|
||
|
|
||
|
def time_per_miles(km, h, m, s):
|
||
|
mi = km / 1.61 # km to mi
|
||
|
total_sec = h *60 + m * 60 + s
|
||
|
return mi / total_sec
|
||
|
|
||
|
def mi_per_h(km, h, m, s):
|
||
|
mi = km / 1.61
|
||
|
total_h = h + m / 60 + s /3600
|
||
|
return mi / total_h
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
vol = volume_sphere(5)
|
||
|
print(vol)
|
||
|
|
||
|
nbre_livre = prix_livre(60, 24.95)
|
||
|
print(nbre_livre)
|
||
|
|
||
|
time = time_per_miles(10, 0, 43, 30)
|
||
|
print(time)
|
||
|
|
||
|
speed = mi_per_h(10, 0, 43, 30)
|
||
|
print(speed)
|
||
|
|