def refund(): status = input( ' Status i intact o open d damaged? '...

50.1K

Verified Solution

Question

Accounting

def refund():

status = input( ' Status i intact o open d damaged? ' )

if status == ' i ' :

refund_rate = 100

elif status == ' o ' :

refund_rate = 90

else:

refund_rate = 80

return refund_rate

def restocking(tier):

if tier == 'gold' :

restocking_fee = 0

else:

restocking_fee = 50

return restocking_fee

#initialize

total = 0

product = int(input( ' Number of products? ' ))

for i in range(product):

items = int(input( ' Number of items? ' ))

price = float(input( ' Price ' ))

membership = (input( ' Membership type g gold s silver? ' ))

rate = refund()

fee = restocking(membership)

returned_items = items * price *rate /100

amount_returned = returned_items - fee

total += amount_returned

print( ' Amount returned: ' , amount_returned)

print( ' Total return' , total)

Assume that during the execution the user inputted the following data:

Number of products? 2

Number of items? 4

Price? 137

Membership type g gold s silver? g

Status i intact o open d damaged? o

Number of items? 5

Price? 130

Membership type g gold s silver? s

Status i intact o open d damaged? i

What is the value of the variable amount_returned at the end of the second interaction of the loop?

Answer & Explanation Solved by verified expert
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students