Lesson 12 of 34

for loop மற்றும் 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 பயன்படுத்தி 5-ன் வாய்ப்பாட்டை (multiplication table) 1 முதல் 10 வரை print செய்யுங்கள். ஒவ்வொரு வரியும் இப்படி இருக்க வேண்டும்: 5 x 1 = 5

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