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 practice articles

1,137 articles · page 25 of 95 · Clear filters
Python practice

Is an element in a set?

Write a Python program to check whether an element is in a set. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Length of a set

Write a Python program to find the number of items in a set. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Remove an element from a set

Write a Python program to remove an element from a set. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Add elements to a set

Write a Python program to add elements to a set. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Create a set

Write a Python program to create a set and show that duplicates are removed. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Python Set Programs with Solutions

48 Python set programs with solutions: create, add, remove, union, intersection, difference, subset, superset, frozenset and more, each explained.

5 min readRead →
Python practice

Sort lines by length

Write a Python program to sort the lines of a file by their length. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Replace spaces with underscores

Write a Python program to replace every space in a file with an underscore. Step-by-step explanation, colour-coded code and real output.

2 min readRead →
Python practice

Words shorter than 5 characters

Write a Python program to display the words of a file that have fewer than 5 characters. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Drop lines containing ‘t’

Write a Python program to copy a file to another file, skipping lines that contain the letter "t". Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Count consonants in a file

Write a Python program to count the consonants in a file. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Count vowels in a file

Write a Python program to count the vowels in a file. 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.