কীওয়ার্ড (Keywords)

Rumman Ansari   Software Engineer   2025-02-01 04:58:24   286  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Table of Content:

Keywords (সংরক্ষিত শব্দ)

Python-এ Keywords হল বিশেষ সংরক্ষিত শব্দ, যেগুলো Python-এর বিল্ট-ইন ফাংশন ও স্টেটমেন্টগুলোর জন্য ব্যবহৃত হয়। এই শব্দগুলো Identifier হিসেবে ব্যবহার করা যাবে না।

✔ Python-এর সমস্ত কীওয়ার্ড তালিকা (Python 3.x)

False None True and as assert
async await break class continue def
del elif else except finally for
from global if import in is
lambda nonlocal not or pass raise
return try while with yield  

আপনি Python-এ নিম্নলিখিত কোড চালিয়ে কীওয়ার্ডগুলোর সম্পূর্ণ তালিকা দেখতে পারেন:


import keyword
print(keyword.kwlist)

✔ Keywords-এর কিছু ব্যবহার

১. if, else, elif (শর্তবদ্ধ স্টেটমেন্ট)


num = 10
if num > 0:
    print("Positive")
elif num < 0:
    print("Negative")
else:
    print("Zero")

২. for, while (লুপ)


for i in range(5):
    print(i)

count = 0
while count < 3:
    print(count)
    count += 1

৩. def (ফাংশন ডিফাইন করা)


def greet():
    print("Hello, World!")
greet()

৪. class (ক্লাস ডিফাইন করা)


class Student:
    def __init__(self, name):
        self.name = name
s1 = Student("Ansari")
print(s1.name)

৫. try-except (ত্রুটি নির্ধারণ ও ব্যতিক্রম হ্যান্ডলিং)


try:
    x = 10 / 0  # Division by zero error
except ZeroDivisionError:
    print("Cannot divide by zero")


উপসংহার

Identifiers (পরিচিতি নাম) হল প্রোগ্রামারের তৈরি নাম, যা ভেরিয়েবল, ফাংশন, ক্লাস ইত্যাদির জন্য ব্যবহৃত হয়।
Keywords (সংরক্ষিত শব্দ) হল Python-এর পূর্বনির্ধারিত শব্দ, যা Identifier হিসেবে ব্যবহার করা যাবে না।

? সঠিকভাবে Identifiers এবং Keywords ব্যবহারের দক্ষতা Python প্রোগ্রামিং শেখার জন্য অপরিহার্য! ?





Stay Ahead of the Curve! Check out these trending topics and sharpen your skills.