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 1 of 4

Python reads almost like English

Change a mark, or add another number to the list, and run it again.

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 reads almost like English
Sign in to run this example in your browser.

Expected output

72 pass
45 try again
90 pass