← PayPal Interview Insights

PayPal·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Technical phone screen for a Data Scientist role at PayPal. One Python fundamentals question that sounds easy but has more layers than you'd expect if you haven't thought about it carefully in a while.

Questions Asked (1)

Q1

What are the key differences between a list and a tuple in Python? Walk through mutability, performance, typical use cases, and when a tuple can be used as a dictionary key.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I covered mutability fine and even threw in a quick code snippet showing you can't reassign a tuple element.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining lists and tuples as Python's two main sequence types, then systematically compare them across mutability, performance, and use cases. Emphasize that tuples are immutable and hashable (if all elements are hashable), which enables their use as dictionary keys, and tie the discussion to data science scenarios like feature engineering or caching.

Pro tip: Mention that tuples can be used as dictionary keys only if all their elements are hashable, and highlight that this immutability also makes tuples safer for concurrent programming and as return values from functions.

1. Define and Contrast Mutability

Explain that lists are mutable (can be modified after creation) while tuples are immutable (cannot be changed). Give a simple example of each.

2. Discuss Performance Implications

Note that tuples are generally faster and more memory-efficient than lists due to their fixed size and immutability. Mention that iteration over tuples can be slightly quicker.

3. Highlight Typical Use Cases

Describe when to use each: lists for homogeneous sequences that need modification (e.g., appending data), tuples for heterogeneous, fixed collections (e.g., coordinates, database records).

4. Explain Hashability and Dictionary Keys

Clarify that tuples are hashable if all their elements are hashable, allowing them to be used as dictionary keys. Lists are never hashable and cannot be used as keys.

5. Connect to Data Science Context

Relate the concepts to data science tasks, such as using tuples for multi-dimensional indexing or caching, and lists for dynamic data storage.

Key Points to Mention

  • Mutability: lists can be changed, tuples cannot.
  • Performance: tuples are faster and use less memory.
  • Use cases: lists for dynamic data, tuples for fixed data.
  • Hashability: tuples are hashable if elements are hashable; lists are not.
  • Dictionary keys: tuples can be keys, lists cannot.
  • Data science relevance: tuples for immutable records, lists for mutable sequences.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.