repl.it
Python

No description

fork
loading
Files
  • main.py
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
#DeQUe

class Deque(object):

  def __init__(self):
    self.items = []
  
  def isEmpty(self):
    return self.items == []

  def rearAdd(self,value):
    self.items.append(value)
  
  def frontAdd(self,value):
    self.items.insert(0,value)
  
  def rearPop(self):
    return self.items.pop()
  
  def frontPop(self):
    return self.items.pop(0)

  def size(self):
    return len(self.items)

  def display(self):
    print(self.items)


?