A Few Things to Try

  • Extend the built-in classes. How about making your shuffle method here an array method? Or how about making factorial an integer method? 4.to_roman, anyone? In each case, remember to use self to access the object the method is being called on (the 4 in 4.to_roman).

Get Learn to Program, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.