Skip to main content
Python

Must-know Python interview questions

2 reported frequent at Stripe. “Reported” because the company tags have no public source. Every quick answer is free.

Questions on this page
2
Must know
0
picked by the editor
Reported frequent
2
company tags, reported
Companies
1
with a frequent tag

Reported frequent· 2

Tagged as frequent at a company. Reported: the tags have no public source.

  1. How do you verify a Stripe webhook signature in Python (Stripe-Signature header, HMAC-SHA256, constant-time compare, timestamp tolerance and secret rotation)?Parse the Stripe-Signature header into t and all v1 values, compute HMAC-SHA256 of "t.raw_body" with the endpoint secret, compare with hmac.compare_digest, and reject timestamps older than the tolerance (default 5 minutes). Use raw bytes, try every secret during rotation, and dedupe by event id.Advanced₹499 (Pro plan required)Reported frequent at Stripe
  2. Write a Python function to flatten a deeply nested JSON/dict into one level with dot-separated keys and list indexes (for example {"a": {"b": [1, {"c": 2}]}} becomes {"a.b[0]": 1, "a.b[1].c": 2}).Walk the structure depth-first with a path string and one shared output dict. Dicts add .key, lists add [index], and scalar leaves (and empty containers) are written to the output. This is O(n) time. Use an explicit stack for very deep input, since recursion fails near Python's recursion limit.Intermediate₹99 (Interview Prep or Pro plan required)Reported frequent at Stripe

Reported frequent at

Must-know questions for other tools