Python Basics (Short Notes)
1. What is Python
High-level, interpreted programming language
Simple syntax and widely used for AI, ML, web, automation, and data
analysis
2. Python Program Example
print("Hello World")
3. Variables
Used to store values.
x = 10
name = "Paritosh"
pi = 3.14
4. Data Types
int → 10
float → 3.14
str → "Hello"
bool → True / False
Example:
a=5
b = 2.5
c = "Python"
5. Input and Output
name = input("Enter your name: ")
print(name)
6. Conditional Statements
x = 10
if x > 5:
print("Greater than 5")
else:
print("Less or equal to 5")
7. Loops
For Loop
for i in range(5):
print(i)
While Loop
i=0
while i < 5:
print(i)
i += 1
8. Lists
numbers = [1,2,3,4]
print(numbers[0])
9. Tuples
t = (10,20,30)
10. Dictionaries
student = {"name":"Ram", "age":20}
print(student["name"])