Question
# 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started