''int' object is not iterable while implementing min max into queue
I am trying to implement min and max into a queue:
class Queue:
"""Queue implementation as a list"""
def __init__(self):
"""Create new queue"""
self._items = []
def is_empty(self):
"""Check if the queue is empty"""
return not bool(self._items)
def enqueue(self, item):
"""Add an item to the queue"""
self._items.insert(0, item)
def dequeue(self):
"""Remove an item from the queue"""
return self._items.pop()
def size(self):
"""Get the number of items in the queue"""
return len(self._items)
def find_min(self):
return sorted(self._items[0]) <=min
def find_max(self):
return sorted(self._items[-1]) <=max
When I try to call find_max I seem to be run into this error:
TypeError: 'int' object is not iterable
Im not entirely sure how to fix this, or if the code is just wack.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
