Python Notes – Day 1
Topics: Introduction, Data Types, Expressions, Statements, Comments
Notes by – Learn Neural
1. Introduction to Python Programming
What is Python?
Python is a high-level, interpreted, and object-oriented programming language with dynamic semantics. It
supports multiple programming paradigms, including procedural, functional, and object-oriented
programming. Python emphasizes code readability with its clean and easy-to-learn syntax, making it ideal
for beginners and professionals alike.
Created by: Guido van Rossum
First Released: 1991
Current Version: Check on python.org
Key Features of Python:
Feature Description
Simple Syntax Python code resembles English, making it easier to read and write.
Interpreted Code is executed line-by-line; no compilation needed.
Open Source Free to download, use, and modify.
Cross-Platform Runs on Windows, macOS, Linux, and more.
Extensive Libraries Huge standard library + third-party packages (NumPy, Pandas, etc.).
Dynamic Typing No need to declare data types explicitly.
Versatile Used in Web Dev, Data Science, AI, Automation, Games, etc.
Python Installation Guide
Step-by-Step Instructions:
1. Visit the official website: https://www.python.org
2. Navigate to Downloads → Select your OS (Windows/macOS/Linux)
3. Download the latest stable release (e.g., Python 3.12.X)
4. Run the installer:
o Check "Add Python to PATH"
o Click "Install Now"
5. After installation, open Command Prompt (CMD):
6. python --version
Output should show something like:
Python 3.12.0
Also install IDEs like VS Code, PyCharm, or use online editors like Replit, Google Colab.
2. Python Data Types
Python automatically identifies the data type when you assign a value to a variable. This is known as
dynamic typing.
1. int (Integer)
Represents whole numbers (positive, negative, or zero).
age = 21
2. float (Floating-point number)
Represents real numbers (with decimal points).
price = 99.99
3. bool (Boolean)
Stores either True or False – often used in conditions.
is_active = True
4. str (String)
Represents text or sequence of characters inside quotes (' ' or " ").
name = "Asmita"
5. list (List)
Stores an ordered collection of values (items can be of different types).
colors = ["red", "green", "blue"]
Use type() to Check Data Type:
print(type(price)) # Output: <class 'float'>
Python also supports more types like tuple, dict, set, complex, NoneType, etc.
3. Variables, Expressions & Statements
Variables
Variables are named memory locations used to store values. In Python:
• No need to declare the type
• Variable names must start with a letter or underscore _
x = 10
y = "Hello"
Expressions
An expression is a combination of variables, operators, and values that produces a result.
result = (x + 5) * 2 # 30
Returns a value
Can be used inside other statements
Statements
A statement is a complete line of instruction to be executed by Python.
print("Welcome to Python!") # ← This is a statement
Types of Statements: (This will be thought in next class)*
• Assignment → x = 10
• Conditional → if, else, elif
• Looping → for, while
• Function definition → def greet():
5. Comments in Python
Comments are used to document code and make it easier to understand. They are ignored by the Python
interpreter.
Single-line Comment:
Begins with #
# This is a single-line comment
Multi-line Comment:
Enclosed in triple quotes ''' or """
"""
This is a
multi-line comment
"""
Best Practices:
• Use comments to explain complex logic
• Avoid obvious comments like # print x above print(x)
Quick Summary Table
Concept Example
Variable x = 10
Expression x+y
Statement print("Hello")
Data Types int, float, str, list
Boolean is_active = True
Comment Syntax # Single or """ Multi-line """
Keep Learning Developers…