Exercise: Structuring a program

The linked file is a Python program which is not well structured. Please fix it!