File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#lex_auth_012693782475948032141
2+
3+
def calculate_bill_amount(food_type,quantity_ordered,distance_in_kms):
4+
bill_amount=0
5+
#write your logic here
6+
if((food_type=="N" or food_type=="V")and quantity_ordered>=1 and distance_in_kms>0):
7+
if(food_type=="V"):
8+
if(distance_in_kms<=3):
9+
bill_amount=120*quantity_ordered+0
10+
elif(distance_in_kms>3 and distance_in_kms<=6):
11+
bill_amount=120*quantity_ordered+((distance_in_kms-3)*3)
12+
else:
13+
bill_amount=120*quantity_ordered+((distance_in_kms-6)*6)+9
14+
else:
15+
if(distance_in_kms<=3):
16+
bill_amount=150*quantity_ordered+0
17+
elif(distance_in_kms>3 and distance_in_kms<=6):
18+
bill_amount=150*quantity_ordered+((distance_in_kms-3)*3)
19+
else:
20+
bill_amount=150*quantity_ordered+((distance_in_kms-6)*6)+9
21+
else:
22+
bill_amount=(-1)
23+
return bill_amount
24+
25+
#Provide different values for food_type,quantity_ordered,distance_in_kms and test your program
26+
bill_amount=calculate_bill_amount("N",2,7)
27+
print(bill_amount)

0 commit comments

Comments
 (0)