Answer to Question #228443 in Python for yum

Question #228443

Write a python program that takes the weight of luggage from the user and prints the total amount the user needs to pay according to the given conditions:

  • The user has to pay Tk.200 if the weight is 10kg or less.
  • The user has to pay Tk.200 and an additional Tk.50 for every 1kg over 10kg.
  • Service charges is 5% of the total weight.
  • Maximum weight of luggage is 30kg.

Sample Input - Sample Output

Luggage Weight: 5 Payment: Tk. 200.25

Luggage Weight: 20 Payment: Tk. 701.0

Luggage Weight: 32 Weight crosses maximum limit


1
Expert's answer
2021-08-22T15:54:05-0400
weight = int(input())
amount = 0

if weight > 30:
    print('Weight crosses maximum limit')
    exit()
if weight <= 10:
    amount = 200
else:
    amount = 200
    difference = weight - 10
    amount += difference * 50
amount += 5 * weight / 100 
print(amount)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS