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
API Data Fetching and Rendering
00:00
5 left

API Data Fetching and Rendering

MediumPython

Problem

Fetch data from a public API endpoint, handle loading and error states, and render the results in a clean, responsive grid layout.

Implement render_api_grid(response, min_card_width) to represent the endpoint result in a testable form. The response contains status, plus items for success or message for errors; return an object containing the UI state and generated HTML.

Constraints

  • response.status is one of loading, error, or success.
  • A successful response contains 0 to 1,000 items.
  • Each item contains id, title, and image_url.
  • min_card_width is an integer from 160 through 320.
  • All text fields may contain HTML-sensitive characters.

Function Signature

def render_api_grid(response, min_card_width):
Interviewer

Your question is API Data Fetching and Rendering. 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.