Python Programming Notes
Chapter 1 & Chapter 2
Chapter 1: Introduction to Python
Python is a high-level, interpreted, general-purpose programming language. It is easy to
learn, easy to read, and very powerful. Python allows programmers to write fewer lines of
code compared to other languages.
Developed By: Guido van Rossum (1991)
Why Python is Popular:
1 Simple and easy to understand syntax
2 Used in AI, Data Science, Web Development, Automation
3 Huge community support
4 Highly demanded in jobs
First Python Program:
print("Hello World")
This program prints Hello World on the screen using the print() function.
Chapter 2: Python Basics
Variables: Variables are used to store data in memory.
Example: age = 20
Data Types:
1 String – text data ("Ankit")
2 Integer – whole numbers (20)
3 Float – decimal numbers (25000.50)
4 Boolean – True or False
Operators:
Arithmetic, Comparison, Logical, and Assignment operators are used to perform
calculations and decisions.
Conditional Statements:
if, else statements are used to make decisions in programs.
Loops:
Loops are used to repeat a block of code. Python has for loop and while loop.
Lists:
Lists store multiple values in a single variable. Example: fruits = ['apple', 'banana']
Functions:
Functions are reusable blocks of code that make programs clean and professional.