Recode in Python

Converting to Python - error with indent
update

update