75 NumPy Interview Questions and Answers for Data Science Professionals

NumPy Interview Questions and Answers 1

NumPy is the backbone of numerical computing in Python. It powers everything from simple arrays to complex calculations and machine learning workflows. Anyone aiming for data science, machine learning, or scientific computing roles really needs to know NumPy well. I have given 75 commonly asked NumPy interview questions. It ranges from basics like arrays and … Read more >>

How to Find the Average of a List in Python (4 Ways)

Python average of list: output of sum() divided by len() on a list of eight USD prices

Many guides still find the average of a list in Python with a counter loop. It works, but it’s five lines for a one-line job. The better answer is sum(prices) / len(prices). Python has no built-in average(), but statistics.mean() is the named version. In this tutorial, I’ll show you the average of a list in … Read more >>

SciPy Signal in Python: Filter, Analyze and Find Peaks

SciPy signal before and after plot: raw noisy vibration signal on top, filtered signal with red peak markers below

An operations lead in Columbus, Ohio sent me a conveyor-motor vibration log buried in 60 Hz hum. SciPy signal cleaned it in four calls: welch(), butter(), sosfiltfilt() and find_peaks(). In this tutorial, I’ll build a small vibration pipeline with the SciPy signal module on Python 3.12.5 with SciPy 1.18.1, step by step. Here’s what we’re … Read more >>

Python Program to Check Prime Number (5 Tested Ways)

Python program to check prime number: Command Prompt output testing 1, 2, 17, 21, 25, 97, 2026 and 2027

Is 2027 prime? A teammate asked us that while testing a date script, and we had to check. Quick answer: a Python program to check prime number values tests divisors from 2 to the square root. No even division, and above 1? It’s prime: In this tutorial, we’ll write a Python program to check prime … Read more >>

Python Program for Selection Sort (With Pass-by-Pass Output)

Python program for selection sort printing each pass on a list of USD invoice totals

A junior developer I mentor had to write a Python program for selection sort on a whiteboard, with no sorted() allowed. The answer is a loop that finds the smallest remaining value and swaps it forward, but he kept swapping inside the inner loop. That bug still sorts, so it slips through. You want one … Read more >>

List vs Set in Python: Differences and When to Use Each

List vs set in Python: Command Prompt output comparing order, duplicates and indexing

List vs set in Python comes down to this: a list keeps items in order and allows duplicates, while a set stores only unique items, has no positions, and checks membership much faster. Pick a list for sequences, a set for uniqueness and lookups: I timed and printed every comparison below on Python 3.12.5, using … Read more >>

Python while Loop (With Examples)

Python while loop: Command Prompt output of a savings loop that runs until the balance reaches 1000 dollars

While loops in Python repeat a block of code as long as a condition stays true. Python checks the condition before every pass, so a Python while loop is the right choice when you don’t know in advance how many times it should run. The examples use US dollars and ZIP codes, and each one … Read more >>

Recursion in Python: A Complete Guide with Examples

Recursion in Python: Command Prompt output tracing the recursive calls and returns of factorial(4) on the call stack

Recursion in Python is when a function calls itself to solve a smaller version of the same problem. Every recursive function needs a base case that stops the calls and a recursive case that moves toward it; without a base case Python stops with RecursionError after about 1,000 calls. This guide shows how Python recursion … Read more >>

How to List Files in a Directory with Python

List files in a directory with Python: Command Prompt output of os.listdir and an isfile filter on a billing folder

An accounts payable team I work with wanted a Python script to list files in a directory every morning: the shared billing folder where vendor invoices land. The obvious os.listdir() call got me halfway. It returns bare names, mixes in subfolders and a hidden sync file, and doesn’t say anything about size or date. Quick … Read more >>