0% found this document useful (0 votes)
2 views6 pages

Python Learning Roadmap

The document provides an overview of programming concepts including variables, data types, control flow, loops, functions, and data structures like lists and dictionaries. It also covers intermediate topics such as string manipulation, file handling, and exception handling, as well as advanced concepts like object-oriented programming, decorators, and multithreading. Each section includes definitions and examples to illustrate the concepts.

Uploaded by

veerapakuraja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Python Learning Roadmap

The document provides an overview of programming concepts including variables, data types, control flow, loops, functions, and data structures like lists and dictionaries. It also covers intermediate topics such as string manipulation, file handling, and exception handling, as well as advanced concepts like object-oriented programming, decorators, and multithreading. Each section includes definitions and examples to illustrate the concepts.

Uploaded by

veerapakuraja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

BASICS

Variables and Data Types


Definition: Containers for storing data values.
Example:
name = "Alice"
age = 25
pi = 3.14
is_valid = True

Operators
Definition: Used to perform operations on variables and values.
Example:
a = 10
b=3
print(a + b)
print(a > b)

Control Flow
Definition: Used for decision-making in code.
Example:
if age >= 18:
print("Adult")
else:
print("Minor")

Loops
Definition: Repeat a block of code multiple times.
Example:
for i in range(3):
print(i)

Functions
Definition: A block of code that runs when called.
Example:
def greet(name):
print(f"Hello, {name}!")
greet("Alice")

Lists and Tuples


Definition: Used to store multiple items in one variable.
Example:
fruits = ["apple", "banana", "cherry"]
coords = (10, 20)

Dictionaries and Sets


Definition: Key-value pairs (dict); unordered unique items (set).
Example:
person = {"name": "Alice", "age": 25}
colors = {"red", "green", "blue"}

INTERMEDIATE

String Manipulation
Definition:
Example:
text = "Hello"
print(text.upper())

List Comprehensions
Definition:
Example:
squares = [x*x for x in range(5)]

File Handling
Definition:
Example:
with open("file.txt", "w") as f:
f.write("Hello file!")

Exception Handling
Definition:
Example:
try:
x=1/0
except ZeroDivisionError:
print("Cannot divide by zero!")

Modules and Packages


Definition:
Example:
import math
print(math.sqrt(16))

ADVANCED

OOP
Definition:
Example:
class Dog:
def __init__(self, name):
self.name = name
def bark(self):
print(f"{self.name} says woof!")
d = Dog("Buddy")
d.bark()

Decorators
Definition:
Example:
def decorator(func):
def wrapper():
print("Before function")
func()
print("After function")
return wrapper

@decorator
def say_hi():
print("Hi!")
say_hi()

Generators
Definition:
Example:
def countdown(n):
while n > 0:
yield n
n -= 1

for i in countdown(3):
print(i)

Lambda Functions
Definition:
Example:
add = lambda x, y: x + y
print(add(2, 3))

Comprehensions
Definition:
Example:
squares = {x: x*x for x in range(5)}
Regex
Definition:
Example:
import re
print(re.findall(r"\d+", "abc123def456"))

Multithreading
Definition:
Example:
import threading

def hello():
print("Hello from thread")

t = threading.Thread(target=hello)
t.start()

Working with APIs


Definition:
Example:
import requests
res = requests.get("https://api.github.com")
print(res.status_code)

Database Connectivity
Definition:
Example:
import sqlite3
conn = sqlite3.connect("test.db")
cursor = conn.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS users (id INTEGER, name TEXT)")
conn.commit()
conn.close()
Unit Testing
Definition:
Example:
import unittest

def add(x, y):


return x + y

class TestAdd(unittest.TestCase):
def test_add(self):
self.assertEqual(add(2, 3), 5)

unittest.main()

You might also like