solve 11 and 12 in Python