In this lesson, we will revisit the fundamental building blocks of Python, including syntax rules, dynamic typing, and variable assignment. Mastering these basics is the essential first step before we begin coding our professional-grade To-Do application.

In Python, variables are essentially labels we create to store data. Unlike languages like C++ or Java, Python is dynamically typed, meaning you do not need to declare a variable's data type before assigning it. When you assign a value using the assignment operator (=), Python automatically determines the type based on the value provided.
For our To-Do application, we will store tasks as strings and completion statuses as booleans. Consider this example:
task_name = "Buy groceries" # String
is_completed = False # Boolean
priority_level = 1 # Integer
Note: Python variable names must start with a letter or an underscore and cannot start with a number. They are also case-sensitive, so
task_nameandTask_nameare treated as two distinct variables. Always use descriptive names liketask_listinstead ofxto keep your code readable.
Python’s syntax is designed for readability, relying on indentation rather than curly braces to define blocks of code. When building our To-Do app, we will frequently work with collections like lists and dictionaries. A list is an ordered sequence of items, denoted by square brackets, which is perfect for storing our series of tasks.
# A list of tasks
tasks = ["Finish report", "Dentist appointment", "Call Mom"]
# Adding a task
tasks.append("Submit PR")
If you store an integer in a variable, you can perform arithmetic operations. For instance, if you want to track how many tasks are remaining, you might perform calculations directly within your logic:

To make our application interactive, we use the input() function to capture user data and the print() function to display information. When using input(), Python always treats the received data as a string. If you intend to take a number from the user—perhaps to select a task ID—you must use type casting, such as int().
Example of capturing a task from a user:
new_task = input("Enter your next task: ")
print(f"You have added: {new_task}")
The f-string notation (prefixing the string with f) allows you to embed variables directly inside the string using curly braces. This is the cleanest way to format output in your application.
int() or str()) when processing user data to ensure the variable type matches your intended operation.Understanding how Python handles data storage is critical for organizing tasks in our application. Imagine you are building a feature to track whether a task is finished and what its description is. Explain the difference between Python's dynamic typing and a statically typed language, and describe why using descriptive variable names like `task_description` instead of a generic name like `var1` is important for maintaining your To-Do application as it grows.