completed version

http://www.codeskulptor.org/#user38_QLTmCaLE1s_0.py