Python Codes for codeeval Questions