There are many ways, but this seems to be the shortest path:
Answer2 = "Yes"
while Answer2 == "Yes":
...
Answer2 = input("Do you want to restart? (Yes/No): ")
Typically you might want to .lower ().strip ()
Answer2 too.
4
solved Restarting code in Python 3.1 [closed]