midtermtwo2013key

# 100 0 c what is the value of result 10 8

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ) (7) Given the following Python code: If the minimum_payment function from project 2 were redesigned to comprise two functions, minimum_pay_main and handle_percent: def handle_percent(balance, percent): ''' return percentage of balance ''' print(balance, percent) # checkpoint 1 multiply_by = .01 * percent return balance * multiply_by def minimum_pay_main(balance): ''' returns credit card minimum payment, which is a given % of the balance or \$10, whichever is more, unless this exceeds the balance, in which case the minimum payment is the balance ''' percent_of_balance = handle_percent(balance, 0) payment = max(10, percent_of_balance) payment = min(payment, balance) return payment When the following code is executed: >>> result = minimum_pay_main(100) b) What is printed at checkpoint 1? 100 0 c) What is the...
View Full Document

## This note was uploaded on 02/12/2014 for the course CIS 122 taught by Professor Staff during the Spring '08 term at University of Oregon.

Ask a homework question - tutors are online