Clear Doubts with Computer TutorIn case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in
# Python code to demonstrate Implementing # stack using list stack = ["Amar", "Akbar", "Anthony"] stack.append("Ram") stack.append("Iqbal") print(stack) print(stack.pop()) print(stack) print(stack.pop()) print(stack) # Python code to demonstrate Implementing # Queue using deque and list from collections import deque queue = deque(["Ram", "Tarun", "Asif", "John"]) print(queue) queue.append("Akbar") print(queue) queue.append("Birbal") print(queue) print(queue.popleft()) print(queue.popleft()) print(queue)
You cannot copy content of this page