code_academy code editted to python 2.7