While loops are powerful, Python offers a concise way to create lists using list comprehension. Imagine you need a list…