Module 2 Notes
Module 2 Notes
Literals: These are the basic data values, like numbers (for example, 1)
Variables: Named places in the computer's memory where data values can be stored.
These values can change while the program runs
Operators: Symbols that do operations on variables and values, like adding or multiplying
(for example, basic math operations like +, - , * and /)
Expressions: These are combinations of literals, variables, and operators that result in a
value (for example, 1 + 2)
Statements: Instructions that the Python interpreter can run, including setting variables
and calling functions
Control Structures: These include if-statements and loops, which help manage how the
program runs
Functions: Blocks of code that can be reused to perform specific tasks. They can take
inputs (called parameters) and give outputs
Classes: Templates for creating objects that group together data and actions
1. Documentation: Using comments make the code easier to read and understand,
especially when working with others
2. Variable Naming Conventions: Choosing clear and descriptive names for variables
to make the code clearer
3. Code Readability: Writing code in a way that is easy to read for future using
Why Python?
Error Types
1. Syntax Errors: Mistakes in the code that break the language rules, stopping the
program from working
2. Runtime Errors: Errors that happen while the program is running, often because of
invalid actions (like trying to divide by zero)
3. Semantic Errors: Logical mistakes where the code runs fine but gives wrong
results, usually due to not understanding the problem
Built in functions are basically pre-defined functions that come with python. It makes
coding easier and more efficient