Lesson 12 of 34

for loop மற்றும் range()for Loops and range()

9 min 25 XP

ஒரே வரியை 100 முறை எழுத வேண்டாம்! for loop ஒரு வேலையை நாம் சொல்லும் எண்ணிக்கையில் திரும்பத் திரும்பச் செய்யும். range(5) என்பது 0, 1, 2, 3, 4.

Don't write the same line 100 times! A for loop repeats work as many times as you say. range(5) gives 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 என்பது ஒவ்வொரு முறையும் எவ்வளவு கூட்ட வேண்டும் என்பது.

range(start, stop, step) starts at start and stops before stop. step is how much to add each time.

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-ன் ஒவ்வொரு எழுத்தின் மீதும் கூடச் செல்லும்.

A for loop can also go through each character of a 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) சேர்க்கப்படாது!

range(1, 11) means 1 to 10. The last number (11) is not included!

Challenge

+25 XP

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

Use a for loop to print the 5 times table from 1 to 10. Each line should look like: 5 x 1 = 5

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