python language     Identify what is wrong with the following code.  Find at least 6 issues.  There are a total of 10 issues (anything over 6 is bonus). # Node Class class Node1     def __init__(self, cargo, next=None):        self.cargo = self        self.next = next       def __str__(self):        return str(self.cargo)   # Priority Queue Class class PriorityQueue():     def __init__():         self.items = []       def is_empty(self):         return not self.items       def insert(self, item):         self.items.add(item)       def remove(self):         maxi = 0         for i in range(1, len(self.items)):             if self.items[i] > self.items[maxi] then:                 maxi = i         item = self.items[maxi]         delete self.items[maxi]         return item   # Golfer Class classes Golfer:     def __init__(self, name, score):         self.name = name         self.score = _score       def __str__(self):         return "{0}: {1}".format(self.name, self.score)       def gt__(self, other):         return self.score < other.score   // Main Program pq = PriorityQueue(Golfer) tiger = new Golfer("Tiger Woods", 61) phil = Golfer("Phil Mickelson", 72) hal = Golfer("Hal Sutton", 69) seth = Golfer("Seth Volpe", 95) jeff = Golfer("Jeff Volpe", 87) mike = Golfer(75, "Mike Voltz") for g in [tiger, phil, hal, seth, jeff, mike]:     PriorityQueue.insert(g) while not pq.is_empty():     print(pq.remove())

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

python language

 

 

Identify what is wrong with the following code.  Find at least 6 issues.  There are a total of 10 issues (anything over 6 is bonus).

  1. # Node Class
  2. class Node1

  3.     def __init__(self, cargo, next=None):

  4.        self.cargo = self

  5.        self.next = next

  6.  
  7.     def __str__(self):

  8.        return str(self.cargo)
  9.  

  10. # Priority Queue Class

  11. class PriorityQueue():

  12.     def __init__():
  13.         self.items = []
  14.  
  15.     def is_empty(self):
  16.         return not self.items

  17.  
  18.     def insert(self, item):

  19.         self.items.add(item)

  20.  
  21.     def remove(self):

  22.         maxi = 0

  23.         for i in range(1, len(self.items)):

  24.             if self.items[i] > self.items[maxi] then:

  25.                 maxi = i

  26.         item = self.items[maxi]

  27.         delete self.items[maxi]

  28.         return item

  29.  

  30. # Golfer Class

  31. classes Golfer:

  32.     def __init__(self, name, score):

  33.         self.name = name

  34.         self.score = _score

  35.  
  36.     def __str__(self):

  37.         return "{0}: {1}".format(self.name, self.score)

  38.  
  39.     def gt__(self, other):

  40.         return self.score < other.score

  41.  

  42. // Main Program

  43. pq = PriorityQueue(Golfer)

  44. tiger = new Golfer("Tiger Woods", 61)

  45. phil = Golfer("Phil Mickelson", 72)

  46. hal = Golfer("Hal Sutton", 69)

  47. seth = Golfer("Seth Volpe", 95)

  48. jeff = Golfer("Jeff Volpe", 87)

  49. mike = Golfer(75, "Mike Voltz")

  50. for g in [tiger, phil, hal, seth, jeff, mike]:

  51.     PriorityQueue.insert(g)

  52. while not pq.is_empty():

  53.     print(pq.remove())

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Stack
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education