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

Size of a file

Write a Python program to get the size of a file in bytes. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Count lines in a file

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

1 min readRead →
Python practice

Compare two files

Write a Python program to compare two files and show the lines that differ. Step-by-step explanation, colour-coded code and real output.

2 min readRead →
Python practice

Mobile numbers from a file

Write a Python program to get all 10-digit mobile numbers from a file. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Odd and even length words

Write a Python program to put the words of a file into two lists by odd and even length. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Create A.txt to Z.txt

Write a Python program to create text files named A.txt to Z.txt. Step-by-step explanation, colour-coded code and real output.

2 min readRead →
Python practice

Count all words in a file

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

1 min readRead →
Python practice

Copy a file in uppercase

Write a Python program to copy a file's contents to another file in uppercase. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Copy a file in lowercase

Write a Python program to copy a file's contents to another file in lowercase. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Random line from a file

Write a Python program to read a random line from a file. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Count a word in a file

Write a Python program to count how many times a word occurs in a file. Step-by-step explanation, colour-coded code and real output.

1 min readRead →
Python practice

Longest word in a file

Write a Python program to find the longest word 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.