bhylu.com

Advertisements

Python Intro

Python lets you turn a small set of instructions into a working program. Start with values you understand, such as a workshop's seat count, and make the result visible.

Understand the idea

Python runs your statements in order. Names refer to objects, and expressions calculate values. You can use the same language for scripts, web services, data work, and tests, but each job needs suitable libraries and an execution environment. This course starts with the standard library rather than a framework.

Where to try it

Open this example with Try in playground. The code loads as editable text and does not run until you select Run. The first run downloads Python. Each run starts fresh; temporary files created by a script are not files on your PC.

A worked example

Python

seats = 12
booked = 5
print("Seats available:", seats - booked)

Read the result

The program prints Seats available: 7. The calculation uses two whole-number values and passes the result to print.

Try one change

Change booked to 12 and explain the result before running it.