def CheckSpeed(speed_limit, car_speed):
if car_speed > speed_limit * 1.1:
print("Fine 500 GBP: speed is 10% above the limit")
elif car_speed > speed_limit * 1.05:
print("Warning: speed is 5% above the limit")
# TEST
if __name__ == "__main__":
speed_limit = 200
normal_speed = 100
warning_speed = 215
fine_speed = 250
CheckSpeed(speed_limit, normal_speed)
CheckSpeed(speed_limit, warning_speed)
CheckSpeed(speed_limit, fine_speed)
Comments
Leave a comment