Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
2.8 kB
3
Indexable
Never
day_type = int(input("Insert day type(1 for weekdays and 2 for weekends/public holiday): "))
boarding_time = int(input("Insert boarding hour and minute: "))
total_distance = float(input("Insert distance travelled in metres: "))
flagdown = 3.90
basic_distance = 1000
distance_left = (total_distance - 1000)

while total_distance > 0:
  if total_distance <= basic_distance:
    if day_type == 1:
      if boarding_time == range(0,600):
        payment = flagdown + (distance_left/400 *   0.22)
        surcharge = (payment * 1.5) + payment
        print("The total payment is", surcharge)
      elif boarding_time in range(600,1000) or boarding_time in range(1800,1200):
        payment = flagdown + (distance_left/400 *   0.22) 
        surcharge = (payment * 1.25) + payment
        print("The total payment is", surcharge)

    elif day_type == 2:
      if boarding_time == range(0,600):
        payment = flagdown + (distance_left/400 *   0.22)
        surcharge = (payment * 1.5) + payment
        print("The total payment is", surcharge)
      elif boarding_time == range(1800,1200):
        payment = flagdown + (distance_left/400 *   0.22) 
        surcharge = (payment * 1.25) + payment
        print("The total payment is", surcharge)
      elif boarding_time == range(600,1000): 
        payment = flagdown + (distance_left/400 *   0.22) 
        print("The total payment is", payment)

  elif total_distance > basic_distance: 
    if day_type == 1:
      if boarding_time == range(0,600):
        payment = flagdown + (distance_left/400 *   0.22)
        surcharge = (payment * 1.5) + payment
        print("The total payment is", surcharge)
      elif boarding_time == range(600,1000) or range(1800,1200):
        payment = flagdown + (distance_left/400 *   0.22) 
        surcharge = (payment * 1.25) + payment
        print("The total payment is", surcharge)


    elif day_type == 2:
      if boarding_time == range(0,600):
        payment = flagdown + (distance_left/400 *   0.22)
        surcharge = (payment * 1.5) + payment
        print("The total payment is", surcharge)
      elif boarding_time == range(1800,1200):
        payment = flagdown + (distance_left/400 *   0.22) 
        surcharge = (payment * 1.25) + payment
        print("The total payment is", surcharge)
      elif boarding_time == range(600,1000): 
        payment = flagdown + (distance_left/400 *   0.22) 
        print("The total payment is", payment)

  else:
    break
  day_type = int(input("Insert day type(1 for weekdays and 2 for weekends/public holiday): "))
  boarding_time = int(input("Insert boarding hour and minute: "))
  total_distance = float(input("Insert distance travelled in metres: "))
  flagdown = 3.90
  basic_distance = 1000
  distance_left = (total_distance - 1000)

else:
  print("<< Have a nice day! >>")