HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Python Programming
  2. /Python for Science and Maths
  3. /NumPy Arrays

NumPy Arrays

Python Programming · High School (11–12) · 1 course, 10 worked problems, 20 practice questions

NumPy is a Python library for working with many numbers at once. Its main tool is the array, a grid of values of one type. You make one with np.array(), np.arange() or np.linspace(). Arithmetic on an array acts on every element, so v = u + a * t finds the speed for a whole array of times in one line, with no loop. Functions such as np.mean(), np.max() and np.sum() summarise data, and slicing picks out parts of it. Arrays are fast, and they sit under most scientific tools in Python.

With practice you will be able to

  • Create arrays with np.array(), np.arange() and np.linspace()
  • Do arithmetic on a whole array without a loop
  • Find the mean, maximum and sum of data in an array

Lessons

  • NumPy ArraysWhy can changing a slice change the whole array? Which angle throws a ball furthest?High School (11–12)

Practice questions

Choose an answer, then check it. Each one shows a full explanation.

Counting in steps: what does print(np.arange(2, 11, 3)) show?

One number from many: what is the mean that print(np.array([1, 2, 3]).mean()) shows?

t = np.array([[1, 2, 3], [4, 5, 6]]). What is t.shape?

Limits on every value: what does print(np.clip(np.array([-5, 3, 12]), 0, 10)) show?

Worked problems

Each one has a hint, the key idea and a full worked solution.

  • Two students write a = [1, 2, 3] and b = np.array([1, 2, 3])…Easy
  • Make each of these arrays with one line of NumPy, and print its shape and its sum…Easy
  • A ball is dropped from a tower 80 m high…Medium
  • Five readings in degrees celsius are -10, 0, 25, 37 and 100…Easy
  • Let a = np.arange(10, 100, 10). By hand, write what these give, then run them to check: a[2]…Easy
  • A student wants to set the first two marks of a copy to zero, and writes this…

Python labs

  • Make the arrays
  • Convert the units
  • Pick with a mask
  • Summarise a data set
  • Marks of a class
  • Project: the best angle

Related topics

  • Python for Science and Maths
  • Graphs with matplotlib
  • Solving Equations
  • Calculus by Computer
  • Simulation and Randomness
  • Data Analysis with pandas
  • Chemistry by Computer
  • Biology by Computer
  • Trigonometry and Waves by Computer

Which function gives exactly 50 equally spaced numbers from 0 to 1, with both ends included?

Why is it faster to add two big arrays with a + b than to add their numbers in a Python loop?

What does np.array([1, 2]) * np.array([3, 4]) give?

a is an array of numbers. Which line picks the numbers that are from 10 to 20, both ends included?

A table has one row for each student and one column for each test. Which call gives one average for each student?

A student writes b = a[:3] and then b[0] = 99. The student is surprised that a[0] is 99 too. What is the reason?

All 20 practice questions on NumPy Arrays →

Medium
  • Four players played three games. The scores are the rows of this table: [[12, 15, 9], [20, 18, 22]…Medium
  • A student measures the length of a rod five times: 10.2, 10.4, 10.1, 10.3 and 10.5 cm…Hard
  • A ball is thrown at 20 m/s on the Moon, where g = 1.6 m/s²…Medium
  • A ball is thrown horizontally at 15 m/s from a roof that is 20 m high…Hard