Python Pioneers: A Beginner's Guide πŸ‡ͺπŸ‡Ή
8.62K subscribers
346 photos
40 videos
24 files
64 links
Welcome to Python Pioneers: Empowering Ethiopian students to embark on their coding journey.

πŸ“’ Channel: @python_pioneers
πŸ‘₯ Group: @python_pioneers_chat
Download Telegram
Control Flow Modifiers in Python

α‰ python Control flow modifiers α‹¨αˆαŠ•αˆ‹α‰Έα‹ α‰ loop α‹ˆα‹­αˆ α‰ conditional statements α‹αˆ΅αŒ₯ αŠ¨αŒˆα‰‘ normal flow of executionαŠ• α‹¨αˆšα‰€α‹­αˆ© statementαŠ¦α‰½ αŠ“α‰Έα‹α’
αŠ₯αŠα‹šαˆ…αˆ modifiers αŠ₯ነ break, continue, αŠ₯αŠ“ pass αŠ“α‰Έα‹

1. break Statement
α‹­αˆ…αŠ• የ break statement α‹¨αˆαŠ•αŒ α‰€αˆ˜α‹ αŠ αŠ•α‹΅αŠ• loop prematurely α‹ˆα‹­αˆ መጨረሻ αˆ‹α‹­ αˆ³α‹­α‹°αˆ­αˆ΅ αˆˆαˆ›α‰†αˆ αˆ΅αŠ•αˆαˆαŒ αŠα‹α’ αŠ₯αŠ“αˆ loopኑ terminate α‹«αˆ¨αŒαŠ“ ከloopኑ ቀαŒ₯ሎ αˆ˜αŒ€αˆ˜αˆͺα‹« α‹«αˆˆα‹ line of code executed α‹­αˆ†αŠ“αˆα’


- ለምሳሌ:

  for i in range(10):
if i == 4:
break
print(i) # Output: 0, 1, 2, 3


2. continue Statement

α‹­αˆ…αŠ›α‹ modifier α‹°αŒαˆž የloopኑ current iteration α‹αˆ΅αŒ₯ α‹«αˆˆα‹αŠ• code α‹˜αˆˆαŠ• α‹ˆα‹° α‰€αŒ£α‹­ iteration αˆˆαˆ›αˆˆα αˆ΅αŠ•αˆαˆαŒ αŠ₯αŠ•αŒ α‰€αˆ˜α‹‹αˆˆαŠ•α’
loopαŠ‘αŠ• terminate αŠ α‹«αˆ¨αŒˆα‹αˆ ፣ it just skips the remaining code for the current iteration.


- ለምሳሌ:

  for i in range(10):
if i % 2 == 0:
continue
print(i) # Output: 1, 3, 5, 7, 9

..to be contd

#break
#continue

@python_pioneers
@python_pioneers
❀3