Lesson 15 of 34
Loop Patterns: கூட்டல், எண்ணுதல், வடிவங்கள்
10 min 35 XP
Pattern 1, கூட்டல் (accumulator): loop-க்கு முன் total = 0 என வைத்து, ஒவ்வொரு சுற்றிலும் கூட்டுங்கள்.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.Pattern 2, எண்ணுதல் (counter): நிபந்தனை உண்மையாகும் போது மட்டும் count-ஐ 1 கூட்டுங்கள்.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.Pattern 3, வடிவங்கள் (shapes): "*" * 3 என்பது "***". இதை loop-உடன் சேர்த்தால் அழகான வடிவங்கள் வரும்.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.இந்த மூன்று patterns-ஐயும் புரிந்துகொண்டால், பல coding interview கேள்விகளை எளிதாகத் தீர்க்கலாம்.