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 26 of 95 · Clear filters
Python practice

Read a file in reverse

Write a Python program to print the lines of a file in reverse order, and the whole text reversed. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Move the cursor with seek()

Write a Python program to move the cursor to a specific position in a file. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Cursor position with tell()

Write a Python program to find the current cursor position in a file. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Count special characters in a file

Write a Python program to count special characters (not letters, digits or whitespace) in a file. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Count digits in a file

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

1 min readRead →
Python practice

Count lowercase letters in a file

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

1 min readRead →
Python practice

Count uppercase letters in a file

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

1 min readRead →
Python practice

Count characters in a file

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

1 min readRead →
Python practice

Merge two files

Write a Python program to read two files and write their contents into a new file. Step-by-step explanation, colour-coded code and real output.

2 min readRead →
Python practice

Characters of a file into a list

Write a Python program to extract the characters (not spaces or newlines) of a file into a list. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Is a file closed?

Write a Python program to check whether a file is closed. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Write a tuple to a file

Write a Python program to write a tuple to a file and read it back. 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.