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