RisingCoder Full course โ†’
Day 1Day 2Day 3Day 4
๐Ÿ”ข
STUDENT NOTES ยท DAY 19 OF 24

Math at Lightning Speed โšก

A million numbers, one line of maths. NumPy is the muscle behind data science and AI.

1Arrays: lists that know maths

๐Ÿ
Py: Multiply a normal list by 2 and it DUPLICATES itself. Multiply a NumPy array by 2 and every number doubles. Very different superpowers!

2Instant statistics

๐Ÿค–
Bittu: A million exam scores? .mean() answers before your finger leaves the Enter key. NumPy runs on optimized C โ€” my native language. ๐Ÿ˜ค

3Making arrays from thin air

๐Ÿฆ‰
Professor Hoot: Note the dots in [0. 0. 0.] โ€” zeros() makes FLOATS by default. And arange works just like range, but array-flavoured.

4shape โ€” always check the shape

5Quick quiz! ๐Ÿง 

np.array([1, 2, 3]) * 2 givesโ€ฆ
๐Ÿ’ก NumPy maths is element-wise: every number gets the treatment. (A plain list would duplicate!)
The universal NumPy import isโ€ฆ
๐Ÿ’ก `as np` โ€” the most famous nickname in Python. Every tutorial on Earth uses it.

6Your mission ๐Ÿš€

Mission 1: Make an array of your last 5 test scores. Print the mean, max and min.
Mission 2: Add 5 grace marks to ALL scores in one line. NumPy magic!
Mission 3: Create np.arange(1, 11) ** 2 โ€” the first ten square numbers, one line.

Day 19 done โ€” lightning mathematician! โšก

Next: pandas โ€” Excel superpowers inside Python.

Go to Day 20: Pandas โ†’

๐ŸŽฎ Or test yourself in the Python Arcade โ†’