How would you implement a stack in Python?
- Using a dictionary
- Using a list
- Using a set
- Using a tuple
In Python, you can implement a stack using a list. Lists provide built-in methods like append() and pop() that make it easy to simulate a stack's behavior.
Loading...
Related Quiz
- In Django, how can you add a column to an existing model’s database table?
- In which block do you write the code that might raise an exception?
- You are tasked with integrating a Python back-end with a complex front-end application developed using React. How would you structure the communication between the front-end and the back-end to ensure scalability and maintainability?
- What's the primary difference between from module import * and import module as alias?
- You need to build a RESTful API with Django that should include filtering, sorting, and pagination functionalities. How would you implement these functionalities efficiently?