py.intro

A short, friendly starting point

Python, from zero.

Before you write a single line, it helps to know how Python thinks. This page walks through the basics: what the language is for, how it wants you to name things, and how it stores data.


    

What we'll cover

Four ideas, in order. Each builds a little on the last.

What is Python?

Python is a high-level programming language, which means it reads much closer to plain English than to the raw instructions a computer executes. That readability is a big part of why it's often a first language.

It's also general-purpose. The same language builds web applications, cleans and reshapes data, and trains machine learning models — you're not learning a niche tool, you're learning something used across most corners of software.

Naming conventions

Python doesn't force much on you, but variable names follow a few habits worth learning early.

Indentation instead of brackets

Most languages mark where a block of code begins and ends with braces. Python uses whitespace instead — the indentation itself is the structure, not just a style choice.

JavaScript

function myFunction() {
  // code lives inside the braces
  // ...
}

Python

def my_function():
    # code lives inside the indent
    # ...

Variables

A variable is a container for a value you want to store and use later. Unlike languages that ask you to declare a type up front — this holds an integer, that holds text — Python figures the type out on its own, from whatever value you assign.

Example assignment

x = 5            # x is an integer
name = "John"     # name is a string
price = 99.99     # price is a float
is_active = True  # is_active is a boolean

The = symbol

It's worth slowing down on this one, because it doesn't mean what it means in a math class. When you write:

name = "John"

not this

name equals John

this

Store the value "John" inside the variable called name.

The = sign is an instruction, not a comparison — it takes whatever is on the right and puts it into the box named on the left.

Data types

The four you'll meet constantly as a beginner:

Integer

1, 2, 3, -40

Float

1.2, 4.6, 2.5

String

"test", "word"

Boolean

True, False

Output — print()

Before a program can ask you anything, it needs a way to talk back. That's what print() is for — it lets your program display information to the user.

The simplest version

print("Hello World!")

Printing a variable

name = "Jordan"

print(name)

Printing text and a variable together

age = 15

print("My age is", age)

Separate them with a comma and print() handles the spacing for you.

student activity

Create these three variables:

name = "Your Name"
age = 15
favorite_color = "Blue"

Then print all three.

Input — input()

Output goes one way: program to person. input() is what lets a person talk back.

name = input("What is your name? ")

print("Hello", name)

The process

So what actually happens when this line runs?

name = input("What is your name? ")

The computer, in order:

  1. Displays the question
  2. Waits for the user
  3. Receives the answer
  4. Stores the answer in name

Mini project — About Me

A first small program, built from everything so far: variables, input, and output.

requirements

The program should ask for:

  • Name
  • Age
  • Favorite food
  • Favorite game

Then display a short introduction.

Example

name = input("What is your name? ")
age = input("How old are you? ")
food = input("What is your favorite food? ")
game = input("What is your favorite game? ")

print("My name is " + name)
print("I am " + age + " years old")
print("My favorite food is " + food)
print("My favorite game is " + game)

Coding challenge

10 marks

A program to write on your own, using everything covered on this page so far.

program name

My Gamer Profile

The program must ask the user for:

  • Their name
  • Their age
  • Their favorite game
  • Their favorite gaming platform

Then display the information.

Example output

===== GAMER PROFILE =====

Name: Alex
Age: 15
Favorite Game: Minecraft
Platform: PC

=========================