Return original

I am working on a bigger project with many steps. I am trying to design a function that takes in my puzzle, sees if something can solve it, then if it cant, simply return the original

def solver(puzzle):
replica=deepcopy(puzzle)
solve(puzzle)
ifcomplete
return puzzle
else:
return replica

I can get it all working but cant make it return the replica. Is there a function to simply to return “original entry” or something similar

This is in regards to Python!

Take care of syntax, indentation etc., preformat the code (Ctrl + Shift + C).

1 Like

I have got it correctly indented it just has shown up on here

Hi @chrussmith, if you format it so that others can see your code as it really is then they will be better able to help.

https://discuss.codecademy.com/t/how-do-i-format-code-in-my-posts/51139

1 Like
     replica=deepcopy(puzzle)`
     solve(puzzle)
     if complete:
         return puzzle
     else:
          return replica```
it stilll doesnt seem to indent :(

That is because the three backticks should be on a line by themselves.

1 Like

I’m closing this topic because there is now a second thread for it over here

1 Like