Python for AIPython for AI
Python Basics

Intro to programming

What programming really means

What is programming?

Programming is simply giving instructions to a computer. Think of it like writing a recipe — you tell the computer exactly what to do, step by step.

When you cook, you follow steps: "Heat oil, add onions, stir for 2 minutes." Programming is the same, except you're telling a computer what to do instead of cooking.

Computers are literal

Here's the key thing: computers do exactly what you tell them — nothing more, nothing less. They can't guess what you mean.

If you tell a friend "make coffee," they know what to do. But a computer needs every detail:

  1. Get a cup
  2. Add coffee grounds
  3. Pour hot water
  4. Wait 3 minutes
  5. Add milk if desired
Be explicit. A missing step won't be guessed — it'll just break.

Basic programming operations

All programming, regardless of language, boils down to a few basic operations:

Store information

python
age = 25
name = "Sarah"

Make decisions

python
if it's raining:
    take umbrella
else:
    wear sunglasses

Repeat actions

python
repeat 10 times:
    do pushup

Calculate things

python
total = price + tax

Your journey

Right now, this might feel abstract. That's normal! As we move through Python basics, each concept will click into place.

Programming is a skill like any other — it takes practice, but anyone can learn it.

Practice

Try these exercises to lock in what you just learned.

Quiz
Not started
What is a program, in the simplest sense?
Quiz
Not started
Python is best described as a(n):
Python playground
Not started
Try it: change the name and run it.

What's next?

Now let's dive into Python syntax — the specific rules for writing Python programs.