Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.4 kB
1
Indexable
Never
number_trips=int (input ("Enter the number of trip:"))

for num in range (0,number_trips):
   
   #input from the user
    day_type=input ("Day Type(weekday=1/weekend(or)ph=2):")
    time=input("Boarding time minute in 24Hour format:")
    distance=float(input("Travelled Distance in meter:"))

    flag_down=3.90 
    basic_distance= 1000
    surchange= 0
 
    midnight=range(0000,600)
    morning_peak_hour=range(600,930)
    evening_peak_hour=range(1800,2360)
 
 
    #calculating basic fare according to distance
    if distance>=1000:
     basic_fare=(distance-1000)/400*0.22
     
    else:
     basic_fare= 3.90
     
     #calculating surcharge
    
    if day_type==1:
     if midnight:
         surcharge=basic_fare* 0.5
         print("Total_fare=", basic_fare+surcharge)
     elif morning_peak_hour:
         surcharge=basic_fare*0.25
         print("Total_fare=", basic_fare+surcharge)
         
     elif evening_peak_hour:
         surcharge+basic_fare*0.25
         print("Total_fare=", basic_fare+surcharge)
     
    else:
     if midnight:
        surcharge=basic_fare* 0.5
        print("Total_fare=", basic_fare+surcharge)
     elif morning_peak_hour:
        surcharge=basic_fare
        print("Total_fare=", basic_fare+surcharge)
         
     elif evening_peak_hour:
        surcharge+basic_fare*0.25
        print("Total_fare=", basic_fare+surcharge)