class SpecialList:     """A list that can hold a limited number of items."""     def __init__(self, size: int) -> None:         """Initialize this special list to hold at most size items.         >>> L = SpecialList(10)         >>> L.size         10         >>> L.value_list         []         """         # complete the code     def push_value(self, new_value: object) -> None:         """Append new_value to this list, if there is enough space in the list          according to its maximum size. If there is insufficient space, new_value          should not be added to the list.         >>> L = SpecialList(2)         >>> L.push_value(3)         >>> L.push_value(4)         >>> L.push_value(5)         >>> L.value_list         [3, 4]         """         # complete the code     def pop_most_recent_value(self) -> object:         """Return the value added most recently to value_list and remove it from         the list.         Precondition: len(self.value_list) != 0         >>> L = SpecialList(10)         >>> L.push_value(3)         >>> L.push_value(4)         >>> L.value_list         [3, 4]         >>> L.pop_most_recent_value()         4         """         # complete the code          def compare(self, other: "SpecialList") -> int:         """Return 0 if both SpecialList objects contain the same number         of items. Return 1 if self contains more items than other.         Return -1 if self contains fewer items than other.         """         # complete the code

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

class SpecialList:
    """A list that can hold a limited number of items."""

    def __init__(self, size: int) -> None:
        """Initialize this special list to hold at most size items.

        >>> L = SpecialList(10)
        >>> L.size
        10
        >>> L.value_list
        []
        """
        # complete the code


    def push_value(self, new_value: object) -> None:
        """Append new_value to this list, if there is enough space in the list 
        according to its maximum size. If there is insufficient space, new_value 
        should not be added to the list.

        >>> L = SpecialList(2)
        >>> L.push_value(3)
        >>> L.push_value(4)
        >>> L.push_value(5)
        >>> L.value_list
        [3, 4]
        """
        # complete the code


    def pop_most_recent_value(self) -> object:
        """Return the value added most recently to value_list and remove it from
        the list.

        Precondition: len(self.value_list) != 0

        >>> L = SpecialList(10)
        >>> L.push_value(3)
        >>> L.push_value(4)
        >>> L.value_list
        [3, 4]
        >>> L.pop_most_recent_value()
        4
        """
        # complete the code

    
    def compare(self, other: "SpecialList") -> int:
        """Return 0 if both SpecialList objects contain the same number
        of items. Return 1 if self contains more items than other.
        Return -1 if self contains fewer items than other.
        """
        # complete the code

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

pop_most_recent_value doesn't work correctly for

Make sure pop_most_recent_value() works correctly when adding more values than space allows for

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
List
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