summaryrefslogtreecommitdiff
path: root/circular_queue.py
diff options
context:
space:
mode:
authorroot <root@turin.home>2022-01-16 13:41:03 +0000
committerroot <root@turin.home>2022-01-16 13:41:03 +0000
commit2ee793179e345f3355462c8d2753543bc397a2aa (patch)
treed1c68adff555f3dc3fbf8a5702855114119bff10 /circular_queue.py
parentbefb917ec5cbcbb0aaae33c53e6c0b2c4b92afcf (diff)
Reformat code
Diffstat (limited to 'circular_queue.py')
-rw-r--r--circular_queue.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/circular_queue.py b/circular_queue.py
index 85516cf..424d1e5 100644
--- a/circular_queue.py
+++ b/circular_queue.py
@@ -1,15 +1,17 @@
class circular_queue:
- def __init__(self,size):
+ def __init__(self, size):
self.size = size
self.queue = []
for i in range(self.size):
self.queue.append(None)
self.pointer = 0
+
def add(self, value):
self.queue[self.pointer] = value
self.pointer += 1
if self.pointer > 49:
self.pointer = 0
+
def average(self):
queue = self.queue
while None in queue: