Here is my python code:
def can_retire(age, isMale, isFemale, canretire, gender): return (isMale != True) and \ ((age>60 and canretire)\ or (canretire / 65>= isFemale) def print_result(output, expected): if output == expected: print 'can retire' else: print 'can retire' def can_retire(): print_result(can_retire(isMale, 60), True) print_result(can_retire(isMale, 59), False) print_result(can_retire(isFemale, 65), True) print_result(can_retire(isFemale, 64), False) if __name__ == '__main__': can_retire()
MOD EDIT: Changed title from "Look at this please". Please do not use titles like that, use a descriptive title like that to which I've changed yours.
Edited by Dogstopper:
This post has been edited by JackOfAllTrades: 25 January 2011 - 05:52 AM