PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Data Manipulation (SQL/Python)/Google

Implement a robust Python generator

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to design memory-efficient Python generators, perform input validation and edge-case handling (None values, non-integers, duplicates), and author comprehensive unit tests within the Data Manipulation (SQL/Python) domain.

  • Medium
  • Google
  • Data Manipulation (SQL/Python)
  • Machine Learning Engineer

Implement a robust Python generator

Company: Google

Role: Machine Learning Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

Given a list of integers, write a Python generator that yields the integers from the list while handling edge cases such as None values, empty input, duplicates, very large inputs (avoid loading everything into memory at once), and non-integer items. Clearly define and document the behavior for None and invalid items (e.g., skip, convert, or raise). Write comprehensive unit tests covering normal paths and edge cases, including input validation, iteration order, resource usage, and error handling.

Quick Answer: This question evaluates a candidate's ability to design memory-efficient Python generators, perform input validation and edge-case handling (None values, non-integers, duplicates), and author comprehensive unit tests within the Data Manipulation (SQL/Python) domain.

Related Interview Questions

  • Generate binomial matrix and column-normalize - Google (Medium)
  • Analyze video flags and reviews with SQL - Google (Medium)
  • Write SQL/Python for messy event data - Google (Medium)
  • Add a conditional column in Python - Google (Medium)
  • Find most co‑purchased product pairs in SQL - Google (Medium)
Google logo
Google
Sep 6, 2025, 12:00 AM
Machine Learning Engineer
Onsite
Data Manipulation (SQL/Python)
3
0

Given a list of integers, write a Python generator that yields the integers from the list while handling edge cases such as None values, empty input, duplicates, very large inputs (avoid loading everything into memory at once), and non-integer items. Clearly define and document the behavior for None and invalid items (e.g., skip, convert, or raise). Write comprehensive unit tests covering normal paths and edge cases, including input validation, iteration order, resource usage, and error handling.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More Google•More Machine Learning Engineer•Google Machine Learning Engineer•Google Data Manipulation (SQL/Python)•Machine Learning Engineer Data Manipulation (SQL/Python)
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.