English

Write the insertion operation of queue containing character using class.

Advertisements
Advertisements

Question

Write the insertion operation of queue containing character using class.

Code Writing
Advertisements

Solution

class CharacterQueue:
    def __init__(self):
        self.queue = []

    def insertion(self, character):
        self.queue.append(character)  # Add at the rear
        print("Character inserted")


characters = CharacterQueue()
characters.insertion("A")
shaalaa.com
  Is there an error in this question or solution?
Chapter 6: Stacks & Queues in list - EXERCISE [Page 123]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 6 Stacks & Queues in list
EXERCISE | Q 14. | Page 123
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×