loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class Stack:
  def __init__(self):
    self.items = []

  def push(self, item):
    self.items.append(item)

  def pop(self):
    self.items.pop()

  def peek(self):
    return self.items[-1]

  def printStack(self):
    for i in self.items:
      print(i)

enchantments = Stack()
enchantments.printStack()
print()
enchantments.push("Fire Resistence")
enchantments.printStack()
print()
enchantments.push("Frost Resistence")
enchantments.push("Lightning Resistence")
enchantments.push("Health Boost")
enchantments.push("Magicka Boost")
enchantments.printStack()
print()
enchantments.pop()
enchantments.printStack()
print()
print("The last item in the stack is " + enchantments.peek())