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.