# Initialize reimbursment = [3, 4, 6] expenses = [] flag = 'y' while flag...

90.2K

Verified Solution

Question

Accounting

# Initialize

reimbursment = [3, 4, 6]

expenses = []

flag = 'y'

while flag == 'y' :

miles = float(input( ' Miles? ' ))

trip = input( ' Trip i in state, o out of state, f foreign? ' )

if trip == ' i ' :

rate = reimbursement [0]

elif trip == ' o ' :

rate = reimbursement [1]

else:

rate = reimbursement [2]

reimburse = miles * rate

expenses.append(reimburse)

flag = input( ' Another reimburse y yes n no? ' )

print(sum(expenses))

Assuming that during the execution of the program the user inputs the following data:

Miles? 121

Trip i in state, o out of state, f foreign? i

Another reimbursement y yes n no? y

Miles? 114

Trip i in state, o out of state, f foreign? o

Another reimbursement y yes n no? y

Miles? 103

Trip i in state, o out of state, f foreign? f

Another reimbursement y yes n no? n

Which is the value of sum(expenses) at the end of the execution of the program?

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