পাইথন প্রোগ্রামিং : লুপ (Python Loops)

1.8 Python Loops

অনেক সময় এমন অবস্থা তৈরি হয় যে একটি নির্দিষ্ট ব্লকের কোড অনেকবার চালানো লাগে, তখন লুপ এর প্রয়োজন হয়। নিচের ছবিটি লক্ষ্য করিঃ

Loop

Python প্রোগ্রামিং ল্যাঙ্গুয়েজে নিচের লুপ গুলো প্রচলিত

.

Loop Type Description
while loop Repeats a statement or group of statements while a given condition is TRUE. It tests the condition before executing the loop body.
for loop Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.
nested loops You can use one or more loop inside any another while, for or do..while loop.

 

Loop Control Statements

কোডিং এর সময় সাধারণ নিয়মের/ সিরিয়ালের পরিবর্তন বোঝাতে Loop control statements এর প্রয়োজন হয়। যখন একটি নির্দিষ্ট লুপের পরিসীমার বাইরের কোড রান হয় তখন ঐ পরিসীমার সকল অবজেক্ট ধ্বংস হয়ে যায়। Python নিচের কন্ট্রোল স্টেটমেন্ট গুলো সাপোর্ট করে।

 

Control Statement Description
break statement Terminates the loop statement and transfers execution to the statement immediately following the loop.
continue statement Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.
pass statement The pass statement in Python is used when a statement is required syntactically but you do not want any command or code to execute.

 

Permanent link to this article: http://bangla.sitestree.com/%e0%a6%aa%e0%a6%be%e0%a6%87%e0%a6%a5%e0%a6%a8-%e0%a6%aa%e0%a7%8d%e0%a6%b0%e0%a7%8b%e0%a6%97%e0%a7%8d%e0%a6%b0%e0%a6%be%e0%a6%ae%e0%a6%bf%e0%a6%82-%e0%a6%b2%e0%a7%81%e0%a6%aa-python-loops/

Leave a Reply