Your First NumPy Lab

NumPyNumPyBeginner
Practice Now

Introduction

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

Click the Continue button below to start the lab.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL numpy(("`NumPy`")) -.-> numpy/ArrayBasicsGroup(["`Array Basics`"]) numpy(("`NumPy`")) -.-> numpy/IndexingandSlicingGroup(["`Indexing and Slicing`"]) python(("`Python`")) -.-> python/ModulesandPackagesGroup(["`Modules and Packages`"]) python(("`Python`")) -.-> python/DataScienceandMachineLearningGroup(["`Data Science and Machine Learning`"]) numpy/ArrayBasicsGroup -.-> numpy/data_array("`Data to Array`") numpy/ArrayBasicsGroup -.-> numpy/attr("`Basic Attributes`") numpy/IndexingandSlicingGroup -.-> numpy/basic_idx("`Basic Indexing`") python/ModulesandPackagesGroup -.-> python/importing_modules("`Importing Modules`") python/ModulesandPackagesGroup -.-> python/using_packages("`Using Packages`") python/DataScienceandMachineLearningGroup -.-> python/numerical_computing("`Numerical Computing`") subgraph Lab Skills numpy/data_array -.-> lab-92735{{"`Your First NumPy Lab`"}} numpy/attr -.-> lab-92735{{"`Your First NumPy Lab`"}} numpy/basic_idx -.-> lab-92735{{"`Your First NumPy Lab`"}} python/importing_modules -.-> lab-92735{{"`Your First NumPy Lab`"}} python/using_packages -.-> lab-92735{{"`Your First NumPy Lab`"}} python/numerical_computing -.-> lab-92735{{"`Your First NumPy Lab`"}} end

Hello NumPy

Let's start by importing the NumPy library. Open a new terminal and type:

python3
Python terminal window open

This will open a Python interpreter. Now, let's import NumPy:

import numpy as np

NumPy is now imported and ready to use. Let's create a NumPy array. We'll start with a simple list of numbers:

a = np.array([10, 20, 30, 40])

We can print the array by typing:

print(a)

Summary

Congratulations! You have completed your first LabEx Lab.

If you want to learn more about LabEx and how to use it, you can visit our Support Center . Or you can watch the video to learn more about LabEx.

Programming is a long journey, but Next Lab is just one click away. Let's do it!

Other NumPy Tutorials you may like