pop from copy

This commit is contained in:
Steven Wilson 2022-12-07 17:20:25 +00:00
parent ef08f0d23a
commit bb15842353
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import re import re
import copy
test = (""" [D] test = (""" [D]
[N] [C] [N] [C]
@ -38,7 +39,8 @@ def rearrange_stacks( input ):
return stack return stack
def read_stacks_top( stacks ): def read_stacks_top( stacks ):
top = list(map(list.pop, stacks)) stacks_c = copy.deepcopy(stacks)
top = list(map(list.pop, stacks_c))
print("".join(top)) print("".join(top))

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import re import re
import copy
test = (""" [D] test = (""" [D]
[N] [C] [N] [C]
@ -38,7 +39,8 @@ def rearrange_stacks( input ):
return stack return stack
def read_stacks_top( stacks ): def read_stacks_top( stacks ):
top = list(map(list.pop, stacks)) stacks_c = copy.deepcopy(stacks)
top = list(map(list.pop, stacks_c))
print("".join(top)) print("".join(top))