Lesson 15 of 34
Loop Patterns: बेरीज, मोजणी आणि आकार
10 min 35 XP
Pattern 1, accumulator: loop च्या आधी total = 0 ठेवा आणि प्रत्येक round मध्ये त्यात भर घाला.
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: condition true असेल तेव्हाच 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, आकार: "*" * 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 प्रश्न सोपे होतात.