Playwright + Python · Lesson 4 of 37
Module 4: Lists, Tuples, Sets & Dictionaries
Your task
Implement get_admin_usernames(users_list):
Write it in the editor, then press Check answer (Ctrl + Enter).
# User credentials dictionary:
user_data = {
"username": "sdet_user",
"role": "ADMIN",
"permissions": ["read", "write", "delete"]
}
# List of dictionaries (test data table):
users = [
{"username": "admin", "role": "ADMIN"},
{"username": "guest", "role": "VIEWER"}
]Lists, dictionaries, and sets are the core data structures used in Python test automation. In this lesson, you will master list operations, dictionary lookups for test parameters, and sets for unique window handles. Let's master collections!
Part of the Playwright + Python course (Playwright with Python). Practice this concept live in the Playwright Online Compiler or explore our free automation practice form.
dict['key'] raises KeyError if the key is missing. dict.get('key') returns None (or a default value) safely without crashing.
Ready? Solve the task in the editor
Use Check answer to mark it complete. Hints are there if you need them.
___