SQA Tools Blog

Learn testing and automation, one article at a time

Free tutorials, solved practice problems and interview prep for QA and automation engineers: Python, Playwright, Selenium, SQL, Git and more.

1,677Articles
1,141Solved Python problems
7Topics
100%Free

Python articles

298 articles · page 10 of 25 · Clear filters
Python practice

Send values into a generator

Write a generator that keeps a running average of values sent to it. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Generator vs list memory

Write a Python program that compares the memory of a list and a generator of a million numbers. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Iterators from zip and enumerate

Write a Python program that shows zip and enumerate return iterators. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Cycle through values

Write a Python program that assigns browsers to 7 tests in rotation. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Unique id generator

Write a generator that produces ids like TC-001, TC-002, . Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Running total

Write a generator that yields the running total of a list. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Flatten nested lists with yield from

Write a recursive generator that flattens nested lists. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Split a list into chunks

Write a generator that yields chunks of a given size. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Generator pipeline

Write a pipeline of generators that reads numbers, keeps the even ones and squares them. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Read a file lazily

Write a generator that yields non-empty, stripped lines from a file. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Custom iterator class

Write an iterator class that returns the characters of a word in reverse. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Iterable class with a generator method

Write a class whose objects can be looped over many times. Step-by-step explanation, colour-coded code and real output.

1 min readRead →

Preparing for a QA interview?

Take free timed mock tests with answers and explanations.