Get startedGet started for free

Looping through a list

Time to test your for-loop skills! In the script.py a list called user_ids has been stored, containing, you guessed it - user IDs!

Your task is to loop through the list and print each ID individually.

This exercise is part of the course

Introduction to Python for Developers

View Course

Exercise instructions

  • Create a for loop to iterate over each user_id in user_ids.
  • Within the for loop, print the user_id.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

user_ids = ["T42YG4KTK", "VTQ39IDQ0", "CRL11YUWX", 
            "K6Y5URXLR", "V4XCBER7V", "IOGQWC61K"]

# Loop through user_ids
____ ____ ____ ____:
  # Print the user_id
  ____
Edit and Run Code