Loading...

The Password Builder

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

Domain
Python
Difficulty
easy
Seniority
junior

Problem

Our provisioning service generates temporary passwords. Write a function called generate_password that takes a length and a character pool string, and builds a password by cycling through the pool. The first character comes from index 0, the second from index 1, and so on, wrapping around when the pool is exhausted. Return the resulting string.

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.