Skip to content
Snippets Groups Projects
Commit 05780632 authored by nilsl99's avatar nilsl99
Browse files

Changed StackList.__init__

parent eb61de54
No related branches found
No related tags found
No related merge requests found
class Stack(list): class Stack():
def __init__(self, l=[]): def __init__(self, l=[]):
self.stack = l self.stack = l
...@@ -35,7 +36,10 @@ class ListElement: ...@@ -35,7 +36,10 @@ class ListElement:
class StackList: class StackList:
def __init__(self, l): def __init__(self, l=None):
if l is None:
self.first_element = None
else:
self.first_element = ListElement(l[-1]) self.first_element = ListElement(l[-1])
element = self.first_element element = self.first_element
for value in l[1::-1]: for value in l[1::-1]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment