Friday, August 15, 2025

Python Core Concepts: Variables, Loops, Functions, OOP

Python Core Concepts: Variables, Loops, Functions, OOP

Variables

ডেটাকে কোনো নামে সংরক্ষণ করাই ভ্যারিয়েবল।

name = "Rahim"

age = 22

is_student = True

Loops

কোনো কাজ বারবার করার জন্য লুপ।

# for loop

for i in range(1, 6):

 print(i)

# while loop

n = 3

while n > 0:

 print("Hi")

 n -= 1

Functions

বারবার ব্যবহারযোগ্য লজিককে ফাংশনে রাখা হয়।

def add(a, b):

 return a + b

print(add(3, 5))

OOP (Object-Oriented Programming)

ডেটা ও বিহেভিয়ারকে ক্লাসের মাধ্যমে সংগঠিত করা।

class Student:

 def __init__(self, name, batch):

 self.name = name

 self.batch = batch

 def intro(self):

 return f"{self.name} - {self.batch}"

s1 = Student("Rahim", "AI-2025")

print(s1.intro())

Practice Checklist

  • ইনপুট নিয়ে ক্যালকুলেটর বানান
  • লুপ দিয়ে সংখ্যার টেবল প্রিন্ট
  • ক্লাস দিয়ে স্টুডেন্ট ম্যানেজমেন্ট (add/list/search)

ডেটা লাইব্রেরি শিখতে পরের পোস্ট দেখুন: NumPy, Pandas, Matplotlib

No comments:

Post a Comment

টিউটোরিয়াল ভিডিও বনাম Traditional Teaching

AI টিউটোরিয়াল ভিডিও vs Traditional Teaching Video AI টিউটোরিয়াল ভিডিও vs Traditional Teaching Video শিক্ষা ও...