Python · live now

Assorted extras

The parts of Python that belong to no single topic: mutability, augmented assignment, type conversions, user input, exceptions, number systems, bitwise operators and precedence.

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

See the full learning path

10

lessons

91

practice questions

73

prerequisite lessons

See it taught

2 of the 10 lessons here are 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
flags = 0b1010 print(flags & 0b0110, hex(flags))

Editor Output

1

Output:

2 0xa

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 10 lessons

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

01

Mutability and immutability

4 questions

Learn how to distinguish between mutable and immutable objects in Python by understanding how each type handles changes to its internal state after creation.

Covers

Mutability and immutability

02

Augmented assignment operators

8 questions

Learn how to use augmented assignment operators in Python to efficiently update variable values, especially for simplifying operations within loops.

Covers

Augmented assignment operators

Usage in for loops

03

Type conversions with list(), tuple() and set()

3 questions

Learn how to convert between different Python data structures using the built-in list(), tuple() and set() functions and understand how these conversions affect properties like uniqueness and order.

Covers

Type conversions with list(), tuple() and set()

04

In-place operations

4 questions

Understand how in-place operations modify mutable objects directly in their current memory location without creating new objects, and see the consequences of assigning the result of such methods.

Covers

In-place operations

05

Accepting user input with input()

8 questions

Learn how to use the input() function to receive user input as a string and correctly convert input values to numbers with int() or float() for arithmetic operations.

Covers

Getting user input with input()

Converting input to numbers

06

Exceptions and try-except

Preview

12 questions

Learn how Python raises exceptions for runtime errors, how to use try-except blocks to prevent crashes, and why catching specific exception types results in safer and more reliable error handling.

Covers

What exceptions are

Basic try-except syntax

Catching specific exception types

Preview this lesson - no account needed

07

Exception hierarchy and propagation

12 questions

Learn how Python matches exceptions in multiple except blocks based on their order and hierarchy, why specific exception types should appear before general ones, and how exceptions propagate up the call stack until handled.

Covers

Multiple except blocks and ordering

Exception hierarchy

Exception propagation

08

Number systems

12 questions

Learn how binary, octal, and hexadecimal number systems work, how to convert between them and decimal, and how to use Python to represent and process numbers in these bases.

Covers

Binary and powers of two

Binary in Python

Introduction to octal and hexadecimal numbers

09

Bitwise operators

Preview

12 questions

Learn how bitwise operators manipulate numbers at the level of individual bits using AND, OR, XOR, NOT and shift operations, and how these operations correspond to changes in binary representation and integer values.

Covers

Introduction to bits

AND and OR

XOR and NOT

Shift operators

Preview this lesson - no account needed

10

Operator precedence and binding

16 questions

Learn how Python decides the order in which operators are evaluated in expressions, distinguishing between operator precedence (when operators have different priorities) and binding or associativity (when operators have equal precedence), and correctly apply these rules to both unary and binary operators.

Covers

Left-to-right binding

Right-to-left binding

Combining precedence and binding

Unary and binary operators

Where this unit sits in the curriculum

This unit is part of our Python Done Right learning path, which contains 103 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 10 red dots are the lessons in Assorted extras; the 73 blue dots feeding into them are the lessons Assorted extras depends on; the 20 pale dots are the rest of the learning path, which come after Assorted extras or alongside it.Assorted extrasFirst lessons on the left103 lessons

Hover any dot to name its lesson.

10 lessons in this unit

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

20 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 Assorted extras

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