Python · live now

Python basics

Write and run your first Python: printing output, comments and keywords, why indentation is part of the syntax, and how a variable refers to an object.

No account needed to read a lesson · 30-day money-back guarantee

See the full learning path

9

lessons

104

practice questions

17

prerequisite lessons

See it taught

1 of the 9 lessons here is free to preview - the whole explanation and worked example, with no account and no email.

The editor you get

A still of the editor, not a live one

Python Editor

1 2 3
name = "Ada" score = 91 print(f"{name} scored {score}%")

Editor Output

1

Output:

Ada scored 91%

You write and run Python in the browser - nothing to install, no setup. Questions are marked on the values your code produces. The snippet here is an example of the kind of code you write.

The 9 lessons

The 9 lessons in this unit. Expand any one to see what it covers. Each unlocks when its own prerequisites are passed.

01

Learning Python in Nodeledge

3 questions

Learn the difference between the Python Editor and Console in Nodeledge and how to use each for writing, running and submitting Python code for interactive questions.

Covers

The Python Editor and Console

Python Editor questions

Python Console questions

02

Introduction to Python

12 questions

Gain a clear understanding of what Python is, how its structure (including syntax and semantics) defines valid programs, and how the Python interpreter reads and executes instructions sequentially.

Covers

An introduction to the Python language

The structure of a programming language

How Python runs our code

03

The Python print() function

Preview

16 questions

Learn how to use Python's print() function to display text and values, include multiple arguments, and customise output formatting using the sep and end arguments.

Covers

Hello World

Introduction to the Python print() function

Printing the value of variables

The sep and end keyword arguments

Preview this lesson - no account needed

04

Comments

12 questions

Learn how to use single and multi-line comments in Python to document code effectively and understand best practices for writing clear, useful comments that enhance code readability and maintainability.

Covers

What are comments?

Single line comments

Multi-line comments using #

05

Keywords in Python

8 questions

Understand what Python keywords are, recognise their role in structuring code, and identify common mistakes such as misspelling, omitting or misusing keywords that lead to syntax errors.

Covers

What are Python keywords?

Incorrect uses of keywords

06

Indentation in Python

20 questions

Learn how Python relies on indentation to define code blocks, understand how correct and consistent indentation is essential in structures like if statements and loops, and see how the pass statement can be used as a placeholder to avoid errors in empty blocks.

Covers

What is indentation

Indentation in if statements

Indentation in for loops

Basic rules of indentation

The pass statement

07

Introduction: variables, assignment, data types and objects

5 questions

Understand variables as references to objects in Python, see how assignment works, recognise fundamental data types such as integers, floats, strings, booleans and lists, and that everything is treated as an object.

Covers

Introduction: variables, assignment, data types and objects

08

Python objects

16 questions

Learn how Python treats everything as an object, how to identify an object's type with type(), and how to access and use object attributes and methods via dot notation.

Covers

Everything in Python is an object

Identifying the type of an object

Object attributes

Object methods

09

Variables and assignment

12 questions

Learn how to create and reassign variables using the assignment operator in Python, understand dynamic typing and how variable types can change at runtime, and apply the rules and conventions for naming variables effectively.

Covers

Variable assignment using the = operator

Dynamic typing in Python and variable reassignment

Variable naming conventions and rules

Where this unit sits in the curriculum

This unit is part of our Python Done Right learning path, which contains 100 lessons. Every one of them is drawn below.

The diagnostic test lets you skip any lesson you already know, including the ones in this unit.

Every dot is a lesson and every line a prerequisite. The 9 red dots are the lessons in Python basics; the 17 blue dots feeding into them are the lessons Python basics depends on; the 74 pale dots are the rest of the learning path, which come after Python basics or alongside it.Python basicsFirst lessons on the left100 lessons

Hover any dot to name its lesson.

9 lessons in this unit

17 prerequisite lessons across the unit, counting every step back to the start

74 other lessons in the learning path - after this unit, or alongside it

Every dot is a lesson, every line a prerequisite. You can only start a lesson once you have mastered all of its prerequisites, so you are always building on solid foundations.

Start Python basics

One subscription covers every learning path, and you can test out of anything you already know.

One subscription covers every learning path · 30-day money-back guarantee

More in Introduction to Python: Basic data types