Return original


#1

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


#2

This is in regards to Python!


#3

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


#4

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


#5

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.


#7

def solver(puzzle):
replica=deepcopy(puzzle)`
solve(puzzle)
if complete:
return puzzle
else:
return replica

it stilll doesnt seem to indent :frowning:


#8

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


#9

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


#10