• Free preview
  • Text
  • 12m

Values, lists and dictionaries

Numbers, text, and the two collections you will use every day.

A program works with values: numbers, text, true or false. You give a value a name with =, and use the name from then on.

python · editable

Enroll in the course to run this code.

0.01 is a float (a number with a fractional part), 20 is an int, and text in quotes is a str.

Lists: values in order

A list keeps several values in order. Positions start at 0, and negative positions count from the end.

python · editable

Enroll in the course to run this code.

Dictionaries: values by name

A dictionary maps keys to values. It is how you keep settings, or one row of a dataset, together.

python · editable

Enroll in the course to run this code.

This was a free lesson from Python for AI: The Essentials

See the full course outline and enroll to keep going.

View the course