Guest User

Untitled

a guest
Jan 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. # It might be better to invert the conditional
  2. # putting the early exit at the top of the
  3. # function
  4.  
  5. # Passes test for f(0), f(1)
  6. def f(term):
  7. # assert term >= 0
  8. if term > 1:
  9. # This part of the implementation
  10. # does not return a correct value,
  11. # BUT preserves the behavior that
  12. # passed the test.
  13. return term
  14.  
  15. # This part of the implementation
  16. # returns the correct value
  17. return term
  18. end
Add Comment
Please, Sign In to add comment