NumPy Exercises

This page provides a collection of hands-on exercises designed to solidify understanding of NumPy. Apply your knowledge to solve practical, real-world data manipulation and analysis challenges. Each exercise offers an opportunity to practice core NumPy concepts, from array creation and manipulation to advanced broadcasting and linear algebra operations, thereby reinforcing the skills acquired throughout the NumPy learning path.

Your First NumPy Lab

Your First NumPy Lab

Hi there, welcome to LabEx! In this first lab, you'll learn the classic 'Hello, World!' program in NumPy.
LabNumPy
NumPy in Space

NumPy in Space

You are part of a team of astronauts on a mission to explore a distant planet. As you begin your journey, you realize that your spaceship's navigation system has malfunctioned, leaving you lost in space! The only way to get back on course is to use the data you have gathered so far and perform some mathematical calculations. Fortunately, you have some knowledge of the NumPy library, which can help you perform these calculations quickly and accurately.
ChallengeNumPy
NumPy Array Datatype Converter

NumPy Array Datatype Converter

NumPy is a powerful library for scientific computing in Python. One of the features of numpy is its ability to efficiently work with arrays. However, sometimes it is necessary to convert a list of integers into a numpy array with a specified datatype. In this challenge, you will be required to write a Python function that converts a list of integers into a numpy array with a specified datatype. This will test your understanding of numpy and data types in Python.
ChallengeNumPy
NumPy Einsum for Scientific Computing

NumPy Einsum for Scientific Computing

In scientific computing, it is often necessary to perform various linear algebra operations. NumPy is a popular Python library that provides efficient and convenient tools for performing such operations. One of the most powerful tools in NumPy is einsum, which stands for Einstein Summation.
LabNumPy
Sorting and Searching

Sorting and Searching

Welcome to the NumPy Sorting and Searching Challenge! This challenge is designed to test your skills in implementing advanced algorithms with NumPy, a powerful library used for numerical computations in Python. Your task is to solve a series of sub-challenges that will involve both sorting and searching algorithms at a high level of complexity. Your solutions should be optimized and make effective use of the functionalities provided by the NumPy library.
ChallengeNumPy
Random Number Generation with NumPy

Random Number Generation with NumPy

For this challenge, you will complete several sub-challenges that will test your skills in generating random numbers with NumPy. Each sub-challenge includes specific tasks that you must complete.
ChallengeNumPy
NumPy List Value Statistics

NumPy List Value Statistics

In this challenge, you will create a Python program using the NumPy library to perform various statistical operations on a list of values. The program will contain multiple sub-challenges that will test your knowledge and understanding of NumPy and its capabilities.
ChallengeNumPy
NumPy Einsum Function

NumPy Einsum Function

This challenge is designed to test your skills in using Numpy's einsum function, which allows you to perform various operations on multi-dimensional arrays. The challenge consists of several sub-challenges that gradually increase in difficulty.
ChallengeNumPy
NumPy Dot Product

NumPy Dot Product

Welcome to the NumPy Dot Challenge! In this challenge, you will be testing your skills in NumPy's dot function, which performs matrix multiplication. The challenge is designed to help you strengthen your skills in using the dot function to solve real-world problems.
ChallengeNumPy
String Operations

String Operations

Welcome to the NumPy Program Challenge focusing on string operations. Dive deep into the world of string manipulation and transformation. This challenge will require a mixture of string functions and programming logic to crack the tasks presented.
ChallengeNumPy
Linear Algebra Solving with NumPy

Linear Algebra Solving with NumPy

In this challenge, you are tasked with writing a Python program that utilizes the NumPy and Linear Algebra libraries to perform matrix inversion. Matrix inversion is a common technique used in linear algebra, and it is useful in many areas of science and engineering.
ChallengeNumPy
Binary Operations Challenge with NumPy

Binary Operations Challenge with NumPy

Binary operations form the very essence of our computational paradigm, enabling us to manipulate data at its most granular level: the bits. This challenge pushes your understanding of binary operations using NumPy to the brink. Each sub-challenge is meant to simulate real-world scenarios, leveraging the NumPy library's power.
ChallengeNumPy
Analyze and Visualize FFT

Analyze and Visualize FFT

In this programming challenge, you will explore the capabilities of NumPy's Fast Fourier Transform (FFT) and Matplotlib libraries to analyze and visualize complex data.
ChallengeNumPy
Numpy Reshape Function

Numpy Reshape Function

The reshape() function in the NumPy library is mainly used to change the shape of an array without changing its underlying data. It helps in providing a new shape to an array that can be useful based on your use case. In this lab, we will cover the basic usage of the reshape() function and the different parameters and values it uses.
LabNumPy
Add a Second Factor to a Login Script

Add a Second Factor to a Login Script

Practice multi-factor authentication by changing a local Python login script from password-only access to password plus an HMAC-based code.
LabNumPy