Syntax, List Comprehensions, Lambda Functions, OOPs, Exception Handling, File I/O & Automation.
Python was created by Guido van Rossum and released in 1991. It is a high-level, interpreted, dynamically typed programming language known for its clean readability and extensive library ecosystem.
| Data Structure | Mutability | Syntax Example | Primary Use Case |
|---|---|---|---|
list | Mutable | [1, 2, "KKCC"] | Ordered collections, flexible element modification |
tuple | Immutable | (10, 20, 30) | Fixed constants, dictionary keys, record tuples |
dict | Mutable | {"name": "Java"} | Key-Value pair lookups, JSON representations |
set | Mutable | {1, 2, 3} | Unique element sets, mathematical set operations |
# List Comprehension with Conditional Filtering
numbers = [1, 2, 3, 4, 5, 6, 7, 8]
squares_even = [x**2 for x in numbers if x % 2 == 0]
# Lambda Function & Map Filter
multiply = lambda a, b: a * b
filtered = list(filter(lambda x: x > 10, squares_even))
print("Filtered Even Squares:", filtered)
class Student:
def __init__(self, name, course):
self.name = name
self.course = course
def display(self):
return f"Student {self.name} is enrolled in {self.course} at KKCC Ongole."
class ScholarStudent(Student):
def __init__(self, name, course, gpa):
super().__init__(name, course)
self.gpa = gpa
s1 = ScholarStudent("Lakshmi", "Python Automation", 9.5)
print(s1.display())
try:
with open("students.txt", "w") as f:
f.write("KKCC INFO SYSTEMS - Ongole Campus\nPython Courseware 2026\n")
except IOError as e:
print(f"File Error: {e}")
BankCustomer with deposit, withdraw, and check balance methods.