Hands-on exercises to practice Python syntax, variables, and data types
This chapter covers the fundamental building blocks of Python programming:
Create a program that swaps the values of two variables.
You can use tuple unpacking: a, b = b, a
Create variables of different data types and examine their properties.
Create a program that takes user input and processes it.
Practice various string operations and methods.
Practice converting between different data types.
Create a basic calculator that takes two numbers and an operator.
Practice different ways to format strings in Python.
Practice using boolean expressions and comparisons.
Demonstrate Python's dynamic typing feature.
Python is dynamically typed, meaning variable types are determined at runtime and can change.