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) शामिल नहीं होती!