First pass at writing these solutions in Python