SHARE
TWEET

zentripetalkraft

DeaD_EyE May 27th, 2018 127 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python3
  2.  
  3. """
  4. Referenz: Google, Wikipedia und https://www.hilfreiche-rechner.de/zentripetalkraft-berechnen.html
  5. """
  6.  
  7.  
  8. def zentripetalkraft(masse, geschwindigkeit, radius):
  9.     return (masse * geschwindigkeit ** 2) / radius
  10.  
  11. def kmh_to_mps(kmh):
  12.     return kmh * 1000 / 3600
  13.  
  14. def km_to_m(km):
  15.     return km * 1000
  16.  
  17. def newton_to_kg(N):
  18.     return N / 9.81 # m/s²
  19.  
  20. def get_mass():
  21.     print('q oder Q zum beenden.')
  22.     while True:
  23.         try:
  24.             frage = 'Masse des objektes in kg (Mensch z.B.): '
  25.             antwort = input(frage)
  26.             if antwort.lower() == 'q':
  27.                 return
  28.             masse = float(antwort)
  29.         except ValueError:
  30.             print('Falsche Eingabe, bitte eine Dezimalzahl eingeben')
  31.             continue
  32.         kraft = zentripetalkraft(masse=masse, **erde)
  33.         fmt = 'Zentripetalkraft {:.3f} N => {:.3f} kg bei 9.81m/s²'
  34.         print(fmt.format(kraft, newton_to_kg(kraft)))
  35.  
  36.  
  37. erde = {'geschwindigkeit': kmh_to_mps(1670), 'radius': km_to_m(6378)}
  38.  
  39. if __name__ == '__main__':
  40.     print('Das Programm berechnet die Zentripetalkraft von Objekten auf der Erde.')
  41.     print('Rotationsgeschwindigkeit der Erde in m/s:', erde['geschwindigkeit'])
  42.     print('Radius der Erde in m:', erde['radius'])
  43.     get_mass()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top