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 ಪ್ರಶ್ನೆಗಳು ಸುಲಭವಾಗುತ್ತವೆ.

Challenge

+35 XP

n = 4 ಗೆ ಈ ತ್ರಿಕೋನ print ಮಾಡಿ: * ** *** ****

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