To elaborate on how this code works, i'll go through with it line by line.
Right at the top of the code it says (restart="Yes" or "yes"). "restart" allows the code to be re-run in the python console after all of it has been run-through once, and it accepts "Yes" or "yes" as true answers.
(choice=input ...) is a basic variable that will be used through out this code.
The rest of this translator is a series of if , elif, and else statements using the "choice" variable that was assigned.