Program is linked as an image ("Image"), although it doesn't look like a link. Preferred method to share code on this forum is by copying it in the post inside Python tags ("Insert python" icon in the edit menu).
If you followed the instructions of the task (write program to a file and run it), bug would reveal itself instantly =)
@OP Oh I see you have edited the post (again with linked image...). But yes, your solution looks ok, which you can easily verify yourself too.