← Back to challenges

Buggy Code (Part 5)

PythonMediumloopsbugsnumbersdata_structures

Instructions

Mubashir created an infinite loop! Help him by fixing the code in the code tab to pass this challenge. Look at the examples below to get an idea of what the function should do.

Examples

print_list(1) ➞ [1]

print_list(3) ➞ [1, 2, 3]

print_list(6) ➞ [1, 2, 3, 4, 5, 6]

Notes

  • READ EVERY WORD CAREFULLY, CHARACTER BY CHARACTER!
  • Don't overthink this challenge; it's not supposed to be hard.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Fix the Error: Check Whether a Given Number Is Odd