Project 18: Registration Flow
Python Challenge
Builds on these lessons
Step 1 of 3
Project
itertools.product for Username Suggestions
Generate a handful of alternate usernames with itertools.product(["jordan"], range(1, 4)) when "jordan" is already taken. itertools builds these combinations lazily, one at a time, instead of constructing the whole cartesian product in memory upfront.
🎯 Your Task
Please add the exact code shown in the light gray box below to your editor.Do not delete your previous code, just insert these new lines in the correct place!
import itertools
base_names = ["jordan"]
suffixes = range(1, 4)
suggestions = [f"{name}{n}" for name, n in itertools.product(base_names, suffixes)]
print(suggestions)