Unformatted text preview: entages on investments while you are retired
(g o t _ a e ), and a list of tuples of e i e e t h u e , where the first value is a
string the name of the house and the second is the annual rent of it. The function should return the
name of most expensive house one can afford, without getting into debts.
Implement the function using binary search. Note that the list of tuples won’t be sorted according to
their prices. First, sort the list of houses by their prices and then run a binary search, to find your house.
complete choosing_retirement_home(savings,g o t _ a e , e i e e t h u e )
The function should return a string the name of the chosen retirement house.
Write your code in the appropriate place in the ex4.py template.
Theoretical and practical important CS comment: Linear search is always faster than first sorting
and then performing a binary search. (Even if the search is efficient, which bubble sort isn't). We ask
you for this implementation only as an exercise. While retired, you will need some leisure activity.
You must write some functions for a Battleship game.
See rules here: http://boardgames.about.com/od/battleship/a/RulesofBattleship.htm
The following ass...
View Full Document
This document was uploaded on 03/20/2014 for the course CMSC 67101 at Hebrew University of Jerusalem.
- Spring '14