Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# Initialize reimbursment = [3, 4, 6] expenses = [] flag = 'y' while flag == 'y' : miles = float(input( ' Miles? ' ))

# 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?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial Accounting Theory And Analysis Text And Cases

Authors: Richard G. Schroeder, Myrtle W. Clark, Jack M. Cathey

9th Edition

9780470128817

More Books

Students also viewed these Accounting questions