Your codeissupposedtoworklikethis f2getvaluekey3

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: d a miss. It also means that if a ship added in middle of a game can cross a partially destroyed ship. Back in ex4.py, we will try to choose our retirement home by different measurement. We will care for two things ­ we must make sure the house is affordable, but the value of the house will be given by a formula depends both on its rent and the number of battleship opponents in it. Assignment 5a: Implement g t v l e k y a function with 1 argument: the v l e added per opponent (default e_au_e, au value = 0), Returns a key function which accepts a triple containing (name of the house ,annual rent, number of opponents) and returns keys such that 'sorted(home_list, key=get_value_key(n))' will return a new sorted list from low to high according to this ranking. you are asked to return a function that given a container of size 3 will return the new value of the house ­ the rent plus the value from battleship opponents. Assignment 5b: Implement c o s _ e i e e t h m _ p o e t, a function with 3 arguments: a hoertrmn_oeopnns b d...
View Full Document

Ask a homework question - tutors are online