educative.io

Dequeue and Lists in Python

I wanted to ask that is it better to use list over a deque in Python? If so why? and if not why not?

Hi Regina,

Thank you for reaching out! We are happy to hear from you.

Well, there is no definitive answer to that, it really depends on your application. As a general rule, if you need fast appends or fast pops, use a deque. If you need fast random access, use a list.

If you have any further queries, please let us know.

1 Like