Lesson 12 of 34

for Loops এবং range()

9 min 25 XP

একই লাইন 100 বার লিখবেন না! for loop যতবার বলবেন ততবার কাজটি করে। range(5) দেয় 0, 1, 2, 3, 4।

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

range(start, stop, step) start থেকে শুরু হয়ে stop-এর আগে থামে। step হলো প্রতিবার কত যোগ হবে।

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

for loop একটি string-এর প্রতিটি অক্ষরের মধ্য দিয়েও যেতে পারে।

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

range(1, 11) মানে 1 থেকে 10। শেষ সংখ্যা (11) ধরা হয় না!

Challenge

+25 XP

for loop দিয়ে 1 থেকে 10 পর্যন্ত 5-এর নামতা print করুন। প্রতিটি লাইন এমন হবে: 5 x 1 = 5

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.