Loading...

The Lazy Squares

A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
easy
Seniority
mid, senior

Problem

Write a generator function that lazily yields the squares of integers from 1 up to and including n, one at a time.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.