solution from python course for undergrads
fix whitespace and comments