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
Python String and List Tasks
00:00
5 left

Python String and List Tasks

EasyPython

Problem

The Hp Iq QA automation pipeline receives a list of result identifiers and a diagnostic string. Implement a function that removes duplicate identifiers while preserving their first-seen order, then counts the vowels in the diagnostic string.

Return both results in a dictionary with keys unique_items and vowel_count.

Formal Specification

Implement process_results(items, text).

  • items is a list containing integers or strings. Values are compared using normal Python equality.
  • text is a string containing ASCII letters, spaces, digits, and punctuation.
  • Duplicate values in items must appear only once, at their first index.
  • Count a, e, i, o, and u regardless of letter case. The letter y is not a vowel, and accented characters are outside the input domain.
  • Return a dictionary: {"unique_items": list, "vowel_count": int}.

Constraints

  • 0 <= len(items) <= 100,000
  • 0 <= len(text) <= 100,000
  • Each item is an integer or string and is hashable
  • Only ASCII vowels a, e, i, o, and u are counted
  • The letter y is not considered a vowel

Function Signature

def process_results(items, text):
Interviewer

Your question is Python String and List Tasks. 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.