Sikau

Python · Day 1 · about 30 min

Values, names and types

Numbers, text, None — and names that point at them.

Why Python?

Python was created by Guido van Rossum and first released in 1991, named after the comedy group Monty Python rather than the snake. Its design goal is readability: code should look close to the plain description of what it does. That's why it has no semicolons, no curly braces around blocks, and very few symbols — indentation shows the structure instead.

Today Python runs data science notebooks, machine learning research, web back ends (Django, Flask, FastAPI), automation scripts, and the glue between other systems. If you already know some programming — say JavaScript — most ideas will feel familiar. This course focuses on what Python does differently, and on writing it the way experienced Python programmers do (they call it *Pythonic* code).

Everything you run in this course is real Python — CPython, the standard interpreter, compiled to WebAssembly and running in your browser. The first run downloads it once, which takes a moment.

Names point at values

Python has no let, const or var. You create a name simply by assigning to it, and the name then refers to a value. Types belong to values, not to names — this is dynamic typing. The same name can point at a number now and a string later, and type(value) tells you what a value is right now.

plates = 3
price = 175.0
shop = "Chiya Ghar"
open_now = True
note = None
print(type(plates), type(price), type(shop))
print(type(open_now), type(note))

Names are case-sensitive and by convention use snake_case: lowercase words joined by underscores. Constants that shouldn't change are written in UPPER_CASE, but that's only a convention — Python won't stop you reassigning them.

Labels, not boxes: Think of a name as a luggage tag tied to a suitcase, not as a box the value lives in. a = b ties a second tag to the same suitcase. That's why two names can share one list — and why changing the list through one name shows through the other.

The rest of this lesson

  • Arithmetic and conversionsexplain
  • Division twicepredict
  • Which type is it?match
  • Convert before you calculatefill
  • Split the chiya billwrite code
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 10 lessons of Python