List Comprehension in Python

Sometimes we need to generate lists which follow some natural logic, such as iterating over a sequence and applying some conditions in them. We can use Python’s “list comprehension” technique to write compact codes to generate lists. We can loop through a sequence, and apply logical expression. First, let’s look at a special function range […]

Read More

How to Create a Thread in Python

Introduction to Python threads What are threads? Simply put, try to imagine them as running several programs concurrently, in a single process. When you create one or more threads in your program, they get executed simultaneously, independent of each other, and most importantly, they can share information among them without any extra difficulty. These features […]

Read More

How to Create a Python Package

Using packages is an essential part of Python programming. If packages didn’t exist, programmers would need to spend a lot of time rewriting code that’s been written before. Picture a scenario where you have to write a parser every time you want to use one – it would waste a lot of time and effort, […]

Read More

Recursive Python Function Example: Make a List of Your Movies!

So. What’s better than making a list of video files on your hard disc drive? Let’s make a list of all video files in a folder, and all other folders in it! What is a Recursive Function in Python? Recursion is a concept in computer science. Essentially, it divides a problem into sub-problems. Recursion in Python […]

Read More