p59.py functional with correct answer