I study python with course MFTI "Алгоритмы на Python 3." So, here I put my code, solving exercises by this course.
http://judge.mipt.ru/mipt_cs_on_python3/labs/lab1.html#o7
https://www.youtube.com/watch?v=KdZ4HF1SrFs&list=PLRDzFCPr95fK7tr47883DFUbm4GeOjjc0