แแแฝแแแ แตแแฐแณแตแแฝแ แ แฃแ แฅแแแฐแแแแ!
แ แดแญแแแแ แแญแ แฅแ แจแแ แตแแแต แแแซแต แแ แแญ แ แตแ แแแซแต แจแแแแแแตแ แขแตแฎแตแซ แแแแแฃแต แแแ แ แแซแญ แแแข
แแแซแ แแฝแต!
@python_pioneers
@python_pioneers
แ แดแญแแแแ แแญแ แฅแ แจแแ แตแแแต แแแซแต แแ แแญ แ แตแ แแแซแต แจแแแแแแตแ แขแตแฎแตแซ แแแแแฃแต แแแ แ แแซแญ แแแข
แแแซแ แแฝแต!
@python_pioneers
@python_pioneers
โค2๐1๐1
https://t.me/tapswap_mirror_1_bot?start=r_6163528558 ๐ +2.5k Shares as a first-time gift
๐2
Infinite Loop
While loopแ แตแแ แแ common แจแแ แฝแแญ แขแแญ แจinfinite loop แแแ แญ แแแข แญแ แ infinite loop conditionแก False แแผแ แ แแญแแแ แต แแ แญแแ แซแแข
Example of an infinite loop:
แจแแญ แซแแ แแฎแแซแ "This will print forever" แจแแแแ แ/แแแญ แซแ แแฐแฅ print แซแจแแแข
Breaking Out of a Loop
Infinite Loop avoid แแแจแ "break" statement แแ แแ แฅแแฝแแแแฃ แญแ แ แจแแ condition set แ แญแแ แฅแแแต แ แแแแ แต แแ loopแกแ exit แฅแแตแแจแ แญแจแณแแแข
แจแแญ แซแแ แแฎแแซแ แแแแชแซ แจแฐแแแ แจ 1 แฅแตแจ 10 แซแ แแฅแฎแฝแ print แฅแแฒแซแจแ แขแแแ แจ'i' value 5 แฒแแ แฅแแฒแซแแ แ แตแ-แแแณ แตแแตแแแฅแ แแญ แจ'i' value 5 แฒแแ loopแก แญแแแแข
Using Else with While Loop
Python 'else' clause แจ while loop แแญ แฅแแตแแ แแ แญแแ แณแแข แจ'else' block executed แจแแแแ แจ while loop condition แแฐแต แฒแแ แแแข (i.e., the loop terminates naturally).
แแณแ
...แญแแฅแแ
#WhileLoop
@python_pioneers
@python_pioneers
While loopแ แตแแ แแ common แจแแ แฝแแญ แขแแญ แจinfinite loop แแแ แญ แแแข แญแ แ infinite loop conditionแก False แแผแ แ แแญแแแ แต แแ แญแแ แซแแข
Example of an infinite loop:
while True:
print("This will print forever")
แจแแญ แซแแ แแฎแแซแ "This will print forever" แจแแแแ แ/แแแญ แซแ แแฐแฅ print แซแจแแแข
Breaking Out of a Loop
Infinite Loop avoid แแแจแ "break" statement แแ แแ แฅแแฝแแแแฃ แญแ แ แจแแ condition set แ แญแแ แฅแแแต แ แแแแ แต แแ loopแกแ exit แฅแแตแแจแ แญแจแณแแแข
i = 1
while i <= 10:
print(i)
if i == 5:
break # Exit the loop when i is 5
i += 1
แจแแญ แซแแ แแฎแแซแ แแแแชแซ แจแฐแแแ แจ 1 แฅแตแจ 10 แซแ แแฅแฎแฝแ print แฅแแฒแซแจแ แขแแแ แจ'i' value 5 แฒแแ แฅแแฒแซแแ แ แตแ-แแแณ แตแแตแแแฅแ แแญ แจ'i' value 5 แฒแแ loopแก แญแแแแข
Using Else with While Loop
Python 'else' clause แจ while loop แแญ แฅแแตแแ แแ แญแแ แณแแข แจ'else' block executed แจแแแแ แจ while loop condition แแฐแต แฒแแ แแแข (i.e., the loop terminates naturally).
แแณแ
i = 1
while i <= 5:
print(i)
i += 1
else:
print("Loop has ended")
...แญแแฅแแ
#WhileLoop
@python_pioneers
@python_pioneers
๐4โค1
Common Use Cases
1. Waiting for User Input: แจแแแแแแ data แฅแตแจแแแแ User input แ แฐแฐแแแ แฅแแตแแแ แ แญแจแณแแแข
2. Processing Data Streams: แแจแจแป แแญ แฅแตแจแแแฐแญแต data แจfile แแญแ แจ network stream continuously แฅแแตแแแฅ แญแจแณแแแข
3. Polling: แจแ แแตแ resource status periodically check แฅแแตแแจแ แญแจแณแแแข
แแณแ: User Input
Here's an example where we keep asking the user for a positive number:
แจแแญ แซแแ แแฎแแซแ userแก positive แแฅแญ แฅแแฒแซแตแแฃ repeatedly แญแ แญแแแแฃ แแฅแฉแ แฐแแ print แซแจแแแฃ if the user enters a positive number the loop ends, because the condition becomes false.
...to be continued
#WhileLoop
@python_pioneers
@python_pioneers
1. Waiting for User Input: แจแแแแแแ data แฅแตแจแแแแ User input แ แฐแฐแแแ แฅแแตแแแ แ แญแจแณแแแข
2. Processing Data Streams: แแจแจแป แแญ แฅแตแจแแแฐแญแต data แจfile แแญแ แจ network stream continuously แฅแแตแแแฅ แญแจแณแแแข
3. Polling: แจแ แแตแ resource status periodically check แฅแแตแแจแ แญแจแณแแแข
แแณแ: User Input
Here's an example where we keep asking the user for a positive number:
number = -1
while number < 0:
number = int(input("Enter a positive number: "))
print("You entered: ", number)
แจแแญ แซแแ แแฎแแซแ userแก positive แแฅแญ แฅแแฒแซแตแแฃ repeatedly แญแ แญแแแแฃ แแฅแฉแ แฐแแ print แซแจแแแฃ if the user enters a positive number the loop ends, because the condition becomes false.
...to be continued
#WhileLoop
@python_pioneers
@python_pioneers
๐2
๐ Let me share with you some beautiful and powerful quotes that I gathered from different sources.๐
- John Green
- Azar Nafisi
- Criolo
- Banksy
- African Proverb
- Anonymous
- Rumi
- Dalai Lama
- Homer Simpson
Have a nice day!
#Quotes
@python_pioneers
@python_pioneers
People were created to be loved. Things were created to be used. The reason why the world is in chaos, is because things are being loved and people are being used.
- John Green
You get a strange feeling when you're about to leave a place. Like you'll not only miss the people you love but you'll miss the person you are now at this time and this place, because you'll never be this way ever again.
- Azar Nafisi
People ask if you have graduated, if you have married, if you have kids, as if life is like a checklist. No one asks you if you're happy
- Criolo
If you get tired, learn to rest, not to quit.
- Banksy
The sun does not forget a village just because it is small.
- African Proverb
A bird sitting on a tree is never afraid of the branch breaking, because its trust is not on the branch but on its own wings. Always believe in yourself
- Anonymous
Raise your words, not your voice. It is rain that grows flowers, not thunder.
- Rumi
If you think you are too small to make a difference, try to sleep with a mosquito in a room.
- Dalai Lama
You can't keep blaming yourself. Just blame yourself once and move on.
- Homer Simpson
Have a nice day!
#Quotes
@python_pioneers
@python_pioneers
โค7๐2๐ฅ1๐1๐1
Forwarded from Python Pioneers: A Beginner's Guide ๐ช๐น (Zaphnath Paaneah) via @OfficialBannersBot
Explore the Lessons We've Been Learning: Click the Links Below to Dive into Various Topics
๐1๐1
Forwarded from ATC NEWS (MuJa. M)
๐ Gain the Skills and International Certifications You Need for Remote Work ๐
Upwork, Toptal, and more - ever wondered what it takes to secure remote work through these top platforms?
Discover ALXโs dynamic online tech courses, tailored to meet todayโs job market demands. Whether youโre starting out or looking to deepen your expertise, we offer a variety of courses, including:
AWS Cloud Computing
Back-End Web Development
Front-End Web Development
Data Analytics
Salesforce
๐ก Start with our 100% free, two-month-long โALX Foundationsโ program - a gateway to these advanced courses for a nominal admin fee! ๐ฅ
๐ Ready to lead in the tech industry? Secure your spot now at www.alxethiopia.com.
Letโs ignite your career journey!
Application deadline: July 2nd, 2024
#InnovateYourPath #FutureReady #SkillUp
Upwork, Toptal, and more - ever wondered what it takes to secure remote work through these top platforms?
Discover ALXโs dynamic online tech courses, tailored to meet todayโs job market demands. Whether youโre starting out or looking to deepen your expertise, we offer a variety of courses, including:
AWS Cloud Computing
Back-End Web Development
Front-End Web Development
Data Analytics
Salesforce
๐ก Start with our 100% free, two-month-long โALX Foundationsโ program - a gateway to these advanced courses for a nominal admin fee! ๐ฅ
๐ Ready to lead in the tech industry? Secure your spot now at www.alxethiopia.com.
Letโs ignite your career journey!
Application deadline: July 2nd, 2024
#InnovateYourPath #FutureReady #SkillUp
๐1
แฐแแ แฅแแฐแแ แแซแฝแ แจแปแแแฝแแข แจ @python_pioneers Subscribers!
แณแแแแ แฅแ แแญแฐแแแฃ แแ แ แแ แญแจแแต แตแแ แญแณแฝแแ แฅแแแฅแแแแฃ แแแแแ แ แญแแต แฅแซแ แแญแ แญแแ แฅแณแจแแฃ แฅแตแจแแฉ แฅแแฝแ แจแแณแตแกแตแ suggestion แจแแตแ แต แแฐแแ แ แตแ แแข
แ แแ แญแจแแต แฅแแ แปแแ แแญ แจแแแ แฎแแฐแแถแฝ:
โซ๏ธContd lessons on Python
โซ๏ธAward-winning questions and quizzes
โซ๏ธTech related news
โซ๏ธLive sessions
โซ๏ธDaily inspiring quotes
โซ๏ธTech related stuffs
โซ๏ธ...
แ แแ แญแจแแต แแฎแแซแแแ แจแแแญ แแณแฅ แซแแฝแ แญแ แปแแ แ แชแ แแแฃ แจแฅแ แแญ แ แแแญ แญแจแแณแฝแแ แแฌแซแ แฅแแฐแแณแฐแญแแ แฅแญแแ แแฝ แแแข
@python_pioneers
@python_pioneers
แณแแแแ แฅแ แแญแฐแแแฃ แแ แ แแ แญแจแแต แตแแ แญแณแฝแแ แฅแแแฅแแแแฃ แแแแแ แ แญแแต แฅแซแ แแญแ แญแแ แฅแณแจแแฃ แฅแตแจแแฉ แฅแแฝแ แจแแณแตแกแตแ suggestion แจแแตแ แต แแฐแแ แ แตแ แแข
แ แแ แญแจแแต แฅแแ แปแแ แแญ แจแแแ แฎแแฐแแถแฝ:
โซ๏ธContd lessons on Python
โซ๏ธAward-winning questions and quizzes
โซ๏ธTech related news
โซ๏ธLive sessions
โซ๏ธDaily inspiring quotes
โซ๏ธTech related stuffs
โซ๏ธ...
แ แแ แญแจแแต แแฎแแซแแแ แจแแแญ แแณแฅ แซแแฝแ แญแ แปแแ แ แชแ แแแฃ แจแฅแ แแญ แ แแแญ แญแจแแณแฝแแ แแฌแซแ แฅแแฐแแณแฐแญแแ แฅแญแแ แแฝ แแแข
แแแซแ แแ แญแแแแฝแ!
@python_pioneers
@python_pioneers
๐4โค1
Control Flow Modifiers in Python
แ python Control flow modifiers แจแแแแธแ แ loop แแญแ แ conditional statements แแตแฅ แจแแก normal flow of executionแ แจแแแญแฉ statementแฆแฝ แแธแแข
แฅแแแ แ modifiers แฅแ
1. break Statement
แญแ แ แจ break statement แจแแแ แแแ แ แแตแ loop prematurely แแญแ แแจแจแป แแญ แณแญแฐแญแต แแแแ แตแแแแ แแแข แฅแแ loopแก terminate แซแจแแ แจloopแก แแฅแ แแแแชแซ แซแแ line of code executed แญแแแแข
- แแแณแ:
2. continue Statement
แญแ แแ modifier แฐแแ แจloopแก current iteration แแตแฅ แซแแแ code แแแ แแฐ แแฃแญ iteration แแแแ แตแแแแ แฅแแ แแแแแแข
loopแกแ terminate แ แซแจแแแ แฃ it just skips the remaining code for the current iteration.
- แแแณแ:
..to be contd
#break
#continue
@python_pioneers
@python_pioneers
แ 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
...contd
3. pass Statement
It is a no-operation statement in Python
-
- แแแณแ:
4. else Clause with Loops
else clause แจloop แแญ แแ แแ แฅแแฝแแแแฃ as long as a break statement is not used.
- แแแณแ:
- แแณแ : elseแ after break แตแแ แแ:
แฅแแแ แ control flow modifiers แแจแณแต แจloops แฅแ conditionals flow manage แ แแจแ efficient แฅแ readable code แแแ แฅแแตแตแฝแ แญแจแณแฝแแแข
#pass
#break
@python_pioneers
@python_pioneers
3. pass Statement
It is a no-operation statement in Python
-
pass statementแ แจแแแ แแแ แฅแแฐ place holder แแแข แแแตแ แจแแ code แฅแจแแแฝแ แจแแ แแ แ แแ แจแแตแจแแฉแต line of code แซแ 'pass' แ แฅแแฐ place holder แตแ แแแณแแฝแแข- แแแณแ:
if condition:
pass # To be implemented later
4. else Clause with Loops
else clause แจloop แแญ แแ แแ แฅแแฝแแแแฃ as long as a break statement is not used.
- แแแณแ:
for i in range(5):
print(i)
else:
print("Loop completed") # This will be printed because the loop was not terminated by a break
- แแณแ : elseแ after break แตแแ แแ:
for i in range(5):
if i == 3:
break
print(i)
else:
print("Loop completed") # This will not be printed because the loop was terminated by a break
แฅแแแ แ control flow modifiers แแจแณแต แจloops แฅแ conditionals flow manage แ แแจแ efficient แฅแ readable code แแแ แฅแแตแตแฝแ แญแจแณแฝแแแข
#pass
#break
@python_pioneers
@python_pioneers
๐ฅ1
แฅแตแช แฅแแแ
แ แจflow control modifiers แจแแก แฅแซแแแฝแ แแญแฏแธแโญ๏ธ
1. Which of the following statements is true about the if statement in Python?
Anonymous Quiz
0%
A) It must always be followed by an else statement.
63%
B) It can include elif statements for multiple conditions.
5%
C) It can only evaluate a single condition.
32%
D) It requires parentheses around the condition.