Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 0.2 — What Python Is and Why the AI World Runs on It
Python · Example 3 of 4

Python on top, fast code underneath

The first run downloads NumPy into your browser, so it takes a few seconds. Both ways give the same total.

Python is a free, general-purpose programming language designed to be easy to read. It is the main language of AI and data work because it is quick to write and because its heavy number-crunching is done by fast libraries written in C, which Python code drives.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 5 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write a program with a list of three temperatures, [31, 18, 25], that prints each temperature followed by warm if it is 25 or more and cool otherwise.

02

Using the standard library, print the average and the highest of the prices [120, 80, 100].

03

Without running it, say what this prints, then check: import math followed by print(math.sqrt(81)).

Explain it without notes

01

What kind of language is Python? Describe it in three or four properties.

02

Why is Python the main language of AI even though it is slower than C or Java?

03

What does "batteries included" mean?

04

Name two kinds of software for which Python is usually not the first choice, and say why.

Python on top, fast code underneath
Sign in to run this example in your browser.

Expected output

Loop:  50005000
NumPy: 50005000