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 python(("`Python`")) -.-> python/DataStructuresGroup(["`Data Structures`"]) python(("`Python`")) -.-> python/ModulesandPackagesGroup(["`Modules and Packages`"]) python(("`Python`")) -.-> python/DataScienceandMachineLearningGroup(["`Data Science and Machine Learning`"]) python(("`Python`")) -.-> python/FunctionsGroup(["`Functions`"]) numpy(("`NumPy`")) -.-> numpy/ArrayBasicsGroup(["`Array Basics`"]) numpy(("`NumPy`")) -.-> numpy/IndexingandSlicingGroup(["`Indexing and Slicing`"]) python/DataStructuresGroup -.-> python/lists("`Lists`") python/DataStructuresGroup -.-> python/tuples("`Tuples`") python/ModulesandPackagesGroup -.-> python/importing_modules("`Importing Modules`") python/DataScienceandMachineLearningGroup -.-> python/numerical_computing("`Numerical Computing`") python/FunctionsGroup -.-> python/build_in_functions("`Build-in Functions`") numpy/ArrayBasicsGroup -.-> numpy/1d_array("`1D Array Creation`") numpy/ArrayBasicsGroup -.-> numpy/data_array("`Data to Array`") numpy/IndexingandSlicingGroup -.-> numpy/bool_idx("`Boolean Indexing`") numpy/IndexingandSlicingGroup -.-> numpy/fancy_idx("`Fancy Indexing`") subgraph Lab Skills python/lists -.-> lab-92735{{"`Your First NumPy Lab`"}} python/tuples -.-> lab-92735{{"`Your First NumPy Lab`"}} python/importing_modules -.-> lab-92735{{"`Your First NumPy Lab`"}} python/numerical_computing -.-> lab-92735{{"`Your First NumPy Lab`"}} python/build_in_functions -.-> lab-92735{{"`Your First NumPy Lab`"}} numpy/1d_array -.-> lab-92735{{"`Your First NumPy Lab`"}} numpy/data_array -.-> lab-92735{{"`Your First NumPy Lab`"}} numpy/bool_idx -.-> lab-92735{{"`Your First NumPy Lab`"}} numpy/fancy_idx -.-> lab-92735{{"`Your First NumPy Lab`"}} end

Hello NumPy

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

python3
lab-hello-world-1-1

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

Coungratulations! 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