You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 line
909 B

  1. #!/usr/bin/env python3
  2. #title :FA-1.py
  3. #description :Final Assignemt: NS Functies
  4. #author :Marcel Haazen
  5. #email :marcel@haazen.xyz
  6. #date :23-09-2019 - 11:53
  7. #version :0.1
  8. #usage :python3 FA-1.py
  9. #notes :
  10. #python_version :3.7.4
  11. #==============================================================================
  12. def standaardtarief(afstandKM):
  13. price = 0.0
  14. if afstandKM <0:
  15. # If distance is negative or 0 the price is also 0
  16. return 0.0
  17. elif afstandKM > 50:
  18. # As of 50 KM the price per KM gets decreased to 60 cents bet gets a base price of 15 euro on top
  19. price = round(15.0 + (afstandKM * 0.6), 2)
  20. return price
  21. else:
  22. # Calculate price per KM based on 80 cents per KM and no base price
  23. price = round(afstandKM * 0.8, 2)
  24. return price
  25. ritprijs
  26. print(standaardtarief(25))