Find a course
Age level: Adults & professionals (18+)BeginnerTechnology & Programming

Python for Beginners

Write real programs with variables, loops, lists, dictionaries and functions

⏱ 2 h 15 min5 modules · 12 lessons81 practice questionsFinal exam: 20 questions
Included with this course

Your certificate for this course

Finish the 12 lessons (about 2 h 15 min) and pass the 20-question final exam. Your Certificate of Completion is ready the moment you pass.

  • Your name and this course titlePrinted in classic diploma typography
  • Grade: Pass, Merit or DistinctionOn the gold seal, with your final score
  • Unique ID and QR codeAnyone can verify it in seconds
  • Score report PDFModule-by-module results and exam score
  1. Lessons12 lessons
  2. Final exam20 questions · 70% to pass
  3. CertificatePDF + score report

What you will learn

  • Install Python or use an online editor, and run scripts and interactive sessions
  • Store data in variables and use int, float, str and bool values with the correct operators
  • Format and slice strings, use f-strings, and convert user input to numbers safely
  • Control program flow with if, elif, else, while loops, for loops and range
  • Create and modify lists, tuples, dictionaries and sets, and choose the right one for a task
  • Write functions with parameters, return values and default arguments, and explain variable scope
  • Read tracebacks, fix common errors, and handle exceptions with try and except
  • Read and write text files and import modules such as math and random

About this course

Python is the most popular first programming language for good reason: its code reads almost like English, it runs everywhere, and the same language powers websites, data analysis, automation scripts, scientific research and machine learning. This free course teaches you to write real Python programs from zero, in one sitting.

You'll start by running your first program and learning how Python stores information in variables: numbers, text and true-or-false values. You'll do arithmetic the way Python does it (including the operators that surprise beginners, such as integer division and remainder), work with strings and f-strings, and read input from a user while converting it to the right type.

Next you'll teach your programs to make decisions with if, elif and else, and to repeat work with while and for loops and the range function. Then you'll organize data with Python's four core collections: lists, tuples, dictionaries and sets. Finally, you'll package code into reusable functions, read error messages calmly, handle errors with try and except, work with files, and import modules from Python's large standard library.

Every lesson explains why the code behaves as it does, shows short programs line by line, and names the mistakes beginners make most often, from forgetting that input returns text to off-by-one errors in ranges. Practice comes in many forms: predicting output, finding bugs, completing code and ordering lines into working programs.

The course is for adults with no programming experience, and for people who have copied scripts before and want to understand them. You can earn a free certificate of completion by passing the final exam.

Syllabus

  1. First Steps in Python

    Run your first programs, learn how Python reads code, and store information in variables of different data types.

    1. Your First Python Program11 min
    2. Variables and Data Types12 min
  2. Working With Numbers and Text

    Do arithmetic the way Python does, format and slice strings, and turn user input into numbers you can calculate with.

    1. Numbers and Operators11 min
    2. Working With Strings13 min
    3. User Input and Type Conversion11 min
  3. Decisions and Loops

    Make programs choose between paths with if, elif and else, and repeat work with while loops, for loops and range.

    1. Making Decisions With if12 min
    2. Repeating With while Loops12 min
    3. for Loops and range13 min
  4. Lists, Dictionaries and Other Collections

    Store many values together in lists, tuples, dictionaries and sets, and choose the right collection for each job.

    1. Lists13 min
    2. Dictionaries, Tuples and Sets13 min
  5. Functions, Errors, Files and Modules

    Package code into reusable functions, handle errors gracefully, read and write files, and use modules from Python's standard library.

    1. Writing Your Own Functions13 min
    2. Errors, Files and Modules14 min
  6. Final exam and certificate

    20 questions drawn from a pool of 36. Score 70% or more to pass; retakes get a fresh set of questions.

Try a sample question

What does the line print("7 + 3") display?

  1. 10
  2. 7 + 3
  3. "7 + 3"
  4. An error, because text and numbers cannot be mixed
Show the answer

Answer: B. 7 + 3

The quotes make 7 + 3 a piece of text, so Python prints the characters exactly as written: 7 + 3. Without the quotes, print(7 + 3) would calculate and print 10. The quotes themselves are not printed.

Interpreter
The program that reads Python code and runs it line by line.
Script
A text file of Python code, usually ending in .py, that runs from top to bottom.
REPL
The interactive Python prompt (>>>) that reads a line, evaluates it, prints the result and loops.
Variable
A name that refers to a value stored in memory, created with an assignment such as count = 0.
Data type
The kind of value, such as int, float, str or bool, which decides what operations are allowed.
Integer (int)
A whole number with no decimal point, such as 42 or -7.

Frequently asked questions

Do I need to install anything?

You can start in a free online Python editor in your browser. For regular practice, install Python 3 from python.org and use a simple editor such as IDLE (included with Python) or a code editor like VS Code. Make sure you use Python 3, not the retired Python 2.

How long does it take to learn Python?

You can learn the fundamentals in this course in a few hours, and become comfortable writing small useful scripts with a few weeks of regular practice. Specialized areas such as web development or data science take months, but they all build on these basics.

Is Python good for getting a job?

Python is widely used in data analysis, automation, web back ends, testing, scientific computing and machine learning, and it appears in many job descriptions. A beginner course is a first step; employers usually want to see projects that use the language to solve real problems.

Why are there no in-browser Python code runners in this course?

The interactive steps focus on reading and predicting code, finding bugs and completing programs, which builds the skills you need before writing longer programs. Type every example into your own Python session as you go; running code yourself is the best practice there is.

What should I learn after this course?

Practice by automating a small task you actually have, such as renaming files or cleaning a spreadsheet. Then explore classes and objects, virtual environments and pip packages, and a focus area such as data analysis with pandas or web development with a framework.

Is the certificate an accredited qualification?

No. It is a certificate of completion showing you finished the lessons and passed the exam. It shows initiative, but it is not an academic credential or a vendor certification.

Sources and further reading

Related courses

TeensBeginner

Python for Teens

Write real programs: games, quizzes and calculators from your first line of code

Technology & Programming
1 h 55 min10 lessonsCertificate
Adults & professionalsBeginner

JavaScript for Beginners

Variables, functions, arrays, objects, the DOM and async code

Technology & Programming
2 h 10 min12 lessonsCertificate
Adults & professionalsBeginner

Git and GitHub Basics

Track changes, branch safely and collaborate with pull requests

Technology & Programming
2 h12 lessonsCertificate
TeensBeginner

Make Games with JavaScript

Code real browser games with variables, loops, canvas drawing, keys and collisions

Technology & Programming
2 h11 lessonsCertificate
KidsBeginner

Coding for Kids

Algorithms, loops, if-then, variables and bug hunting, then write real JavaScript

Technology & Programming
1 h7 lessonsCertificate
University studentsIntermediate

Regular Expressions

Match, extract and replace text with regex in JavaScript, Python and your editor

Technology & Programming
2 h 45 min12 lessonsCertificate