Development

Python Programming for Beginners

Variables, decisions, loops, functions, and small programs you can read.

★★★★★4.8 · Based on 156 learners54 lessons · 13 hr 30 min

Python Programming for Beginners starts from a blank file. You will write variables, decisions, loops, and functions, then put them together in short programs. No earlier coding course is assumed. Replay a lecture when a line does not behave the way you expected.

Course syllabus

  1. 01. First programs

    • Install Python and run a file

      The editor, the terminal, and a program that prints one line.

      15 min
    • A folder for this course

      Keep each exercise in its own file so you can find it tomorrow.

      17 min
    • What a program actually is

      A file of instructions the computer follows from top to bottom.

      13 min
    • Print a result you can read

      A message that says what the program did, not only that it finished.

      16 min
    • Comments for the next reader

      A short note above a line that will look odd in a week.

      18 min
    • Read a traceback

      The file name, the line number, and the sentence that says what broke.

      14 min
    • Fix one error at a time

      Change the line the traceback names, then run the file again.

      18 min
    • Save before you run

      The terminal runs the file on disk, not the unsaved tab.

      12 min
  2. 02. Variables and types

    • Names and values

      A name that points at a value you want to use again.

      17 min
    • Text and numbers

      A word in quotes is not the same thing as a number you can add.

      15 min
    • Why the type matters

      Adding two numbers and joining two pieces of text are different jobs.

      16 min
    • Convert a value on purpose

      Turn keyboard text into a number only when the text really is a number.

      13 min
    • Ask for input

      Read one line from the person running the program.

      15 min
    • A clear printed answer

      Say what the number means, not just the digits.

      17 min
    • Names you can say out loud

      A name that tells you the value, so you do not need a comment.

      13 min
    • Reuse a value instead of retyping it

      Store the result once and use the name in the next lines.

      16 min
  3. 03. Decisions

    • A condition that is true or false

      A comparison the program can answer yes or no.

      18 min
    • Decisions with if

      Run a block only when the condition holds.

      14 min
    • An else for the other path

      What the program does when the condition does not hold.

      18 min
    • More than two branches

      Choose among several cases without stacking a mess of copies.

      12 min
    • Compare text carefully

      Spaces and capital letters change what a match means.

      17 min
    • Combine two checks

      Both must be true, or either one is enough. Pick the one you mean.

      15 min
    • A small decision exercise

      A price and a discount that only apply when the rule says so.

      16 min
  4. 04. Loops

    • Repeat with a while loop

      Keep going until a condition becomes false.

      13 min
    • Make sure the loop can stop

      Something inside the loop has to change, or it never ends.

      15 min
    • Loop a known number of times

      A range when you already know how many passes you need.

      17 min
    • Skip or leave early

      Continue to the next pass, or break when the work is already done.

      13 min
    • A running total

      Add into one variable as the loop walks the numbers.

      16 min
    • Do not copy the same lines

      If you pasted the block twice, it wants to be a loop.

      18 min
    • A loop you can explain

      Say when it starts, what changes, and when it stops.

      14 min
  5. 05. Functions

    • Name a piece of work

      A function is a labelled block you can run by name.

      18 min
    • Parameters

      Values the caller passes in, so the function is not stuck to one number.

      12 min
    • Return a result

      Send a value back. Printing is not the same as returning.

      17 min
    • Call one function from another

      Small functions that do one job, used by a larger one.

      14 min
    • A default when the caller omits a value

      A sensible fallback that is still visible in the definition.

      15 min
    • Keep the main file short

      The bottom of the file should read like the steps of the program.

      12 min
    • Test a function with one example

      Run it with a value you can check by hand.

      14 min
    • Functions

      The original idea, now as a lecture you can replay: name the work and return the result.

      16 min
  6. 06. Lists and dictionaries

    • A list of values

      Several items in order, kept under one name.

      12 min
    • Index and length

      The first item is zero, and length tells you when to stop.

      15 min
    • Add and remove an item

      Change the list without rebuilding it by hand.

      18 min
    • Loop over a list

      Visit each item once and do the same small job.

      13 min
    • Find an item

      Look for a value and decide what to do if it is missing.

      17 min
    • A dictionary of named fields

      A key you can look up, instead of remembering a position.

      11 min
    • A missing key

      Check before you read, so a typo does not crash the program.

      16 min
    • A tiny address book in memory

      Names and numbers stored together, then printed as a list.

      14 min
  7. 07. A small program

    • Describe the program before you code

      Inputs, the rule, and the line you want to print.

      15 min
    • Split the work into functions

      Read, calculate, and print as three names.

      12 min
    • Reject bad input

      A blank line or a word where a number was required.

      14 min
    • The happy path

      Valid input goes in, and a sentence comes out.

      16 min
    • A small complete program

      Read input, process it, and print a clear result.

      12 min
    • Run it twice with different numbers

      The same file should work for more than one example.

      15 min
    • What you would change next

      One improvement you can name, even if you do not build it yet.

      18 min
    • Explain the file to someone else

      Walk the functions in order without reading every line aloud.

      13 min

Lecture videos stay with the course. Playback for enrolled students will open once payments are available. Video links are not published on this page.