class Node(object): def __init__(self, val, nxt = None): self.val = val self.nxt = nxt class Stack(object): size = 0 def __init__(self, top = None): = top def push(self, data): if is None: = Node(data) else: newNode = Node(data) = = newNode size += 1 def pop(self): if is None: return None else: popped = = size -= 1 return popped
Implementare in Python despre problema 1 de la seminar a stivei

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.