Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Transaction History With Search
00:00
5 left

Transaction History With Search

MediumPython

Problem

Build a simplified transaction history screen that fetches data from a mock API, supports pull-to-refresh, and implements local search filtering.

Model API responses as api_responses, a list of transaction lists. Each transaction has id, description, and status. The function performs the initial fetch, processes actions such as search:<query> and refresh, and returns the visible transaction list after each state change. Search matches description or status, case-insensitively. Refresh replaces the current data with the next mock response while preserving the active query.

Input: transaction_history(api_responses, actions).

Output: A list of visible transaction-list snapshots, including the initial fetch.

Constraints

  • 1 <= len(api_responses) <= 1000
  • 1 <= len(api_responses[0]) <= 1000
  • Each refresh action has a corresponding later API response
  • Each transaction contains string fields id, description, and status
  • Actions are either "refresh" or strings beginning with "search:"
  • Search matching is case-insensitive and uses substring matching

Function Signature

def transaction_history(api_responses, actions):
Interviewer

Your question is Transaction History With Search. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.