? Python for Beginners
? Python for Beginners
1. What is Python?
Python is a high-level, interpreted programming language known for its simple and readable
syntax. It’s used in web development, data science, automation, AI/ML, and more.
Install Python:
• Beginner-friendly IDEs:
Variables
python
CopyEdit
name = "Alice"
age = 25
is_student = True
Data Types
Type Example
int age = 25
python
CopyEdit
print("Hello", name)
If-Else Statements
python
CopyEdit
age = 18
print("Adult")
else:
print("Minor")
Loops
For Loop:
python
CopyEdit
for i in range(5):
print(i) # 0 to 4
While Loop:
python
CopyEdit
x=0
while x < 5:
print(x)
x += 1
Functions
python
CopyEdit
def greet(name):
print(greet("Alice"))
python
CopyEdit
import random
if guess == number:
print("Correct!")
else: