loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.21587513753741705","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"Y2xhc3MgTm9kZToKICBkZWYgX19pbml0X18oc2VsZiwgZGF0YSk6CiAgICBzZWxmLmRhdGEgPSBkYXRhCiAgICBzZWxmLm5leHROb2RlID0gTm9uZQoKY2xhc3MgUXVldWU6CiAgZGVmIF9faW5pdF9fKHNlbGYpOgogICAgc2VsZi5maXJzdCA9IE5vbmUKICAgIHNlbGYubGFzdCA9IE5vbmUKICAKICBkZWYgZW5RdWV1ZShzZWxmLCBkYXRhKToKICAgIGlmIG5vdCBzZWxmLmZpcnN0OgogICAgICBzZWxmLmZpcnN0ID0gTm9kZShkYXRhKQogICAgICBzZWxmLmxhc3QgPSBzZWxmLmZpcnN0CiAgICAgIHJldHVybgogICAgc2VsZi5sYXN0Lm5leHROb2RlID0gTm9kZShkYXRhKQogICAgc2VsZi5sYXN0ID0gc2VsZi5sYXN0Lm5leHROb2RlCgogIGRlZiBkZVF1ZXVlKHNlbGYpOgogICAgdGVtcCA9IHNlbGYuZmlyc3QKICAgIHNlbGYuZmlyc3QgPSBzZWxmLmZpcnN0Lm5leHROb2RlCiAgICByZXR1cm4gdGVtcAogIAogIGRlZiBwcmludFF1ZXVlKHNlbGYpOgogICAgdGVtcCA9IHNlbGYuZmlyc3QKICAgIHdoaWxlIHRlbXA6CiAgICAgIHByaW50KHRlbXAuZGF0YSkKICAgICAgdGVtcCA9IHRlbXAubmV4dE5vZGUKCnByaW50KCJDcmVhdGluZyBlbXB0eSBxdWV1ZS4uLiIpCm15USA9IFF1ZXVlKCkKcHJpbnQoKQoKcHJpbnQoIkNyZWF0aW5nIHR3byB2YXJpYWJsZXMgY29udGFpbmluZyBkYXRhLi4uIikKZmlyc3ROb2RlID0gMTUKc2Vjb25kTm9kZSA9IDIwCnByaW50KCkKCnByaW50KCJBZGRpbmcgdHdvIG5vZGVzIHRvIHRoZSBxdWV1ZS4uLiIpCm15US5lblF1ZXVlKGZpcnN0Tm9kZSkKbXlRLmVuUXVldWUoc2Vjb25kTm9kZSkKcHJpbnQoKQoKcHJpbnQoIlZlcmlmeWluZyB0aGF0IHRoZSBub2RlcyB3ZXJlIGVuUXVldWVkLi4uIikKbXlRLnByaW50UXVldWUoKQpwcmludCgpCgpwcmludCgiVGVzdGluZyB0aGUgZGVRdWV1ZSBmdW5jdGlvbi4uLiIpCmRlUXVldWVkTm9kZSA9IG15US5kZVF1ZXVlKCkKbXlRLnByaW50UXVldWUoKQpwcmludCgpCgpwcmludCgiTWFraW5nIHN1cmUgdGhlIGRlUXVldWUgcmV0dXJuZWQgdGhlIG5vZGUuLi4iKQpwcmludCgiLi4uYW5kIGFkZGluZyBkZVF1ZXVlZCBub2RlIGJhY2sgaW4uLi4iKQpteVEuZW5RdWV1ZShkZVF1ZXVlZE5vZGUuZGF0YSkKbXlRLnByaW50UXVldWUoKQ=="},"asBuffer":null},"loaded":true}}
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class Node:
  def __init__(self, data):
    self.data = data
    self.nextNode = None

class Queue:
  def __init__(self):
    self.first = None
    self.last = None
  
  def enQueue(self, data):
    if not self.first:
      self.first = Node(data)
      self.last = self.first
      return
    self.last.nextNode = Node(data)
    self.last = self.last.nextNode

  def deQueue(self):
    temp = self.first
    self.first = self.first.nextNode
    return temp
  
  def printQueue(self):
    temp = self.first
    while temp:
      print(temp.data)
      temp = temp.nextNode

print("Creating empty queue...")
myQ = Queue()
print()

print("Creating two variables containing data...")
firstNode = 15
secondNode = 20
print()

print("Adding two nodes to the queue...")
myQ.enQueue(firstNode)
myQ.enQueue(secondNode)
print()

print("Verifying that the nodes were enQueued...")
myQ.printQueue()
print()

print("Testing the deQueue function...")
deQueuedNode = myQ.deQueue()
myQ.printQueue()
print()

print("Making sure the deQueue returned the node...")
print("...and adding deQueued node back in...")
myQ.enQueue(deQueuedNode.data)
myQ.printQueue()