Problem 5 in python complete

Completed Problem 5 in python