Python Pioneers: A Beginner's Guide 🇪🇹 – Telegram
Python Pioneers: A Beginner's Guide 🇪🇹
8.88K subscribers
345 photos
39 videos
24 files
61 links
Welcome to Python Pioneers: Empowering Ethiopian students to embark on their coding journey. 🚀🌐🗺📱🖥💻🖱🛰

DM 📩 : @MntsntZP
Download Telegram
1⃣
FOR LOOP

What will be the output of the above code?

Comment your answer!

@python_pioneers
1
Denoscription for the above code

The above Python code will print the string "hello world" ten times. Here's a breakdown of how it works:

1. The for loop is set to iterate over the range from 1 to 10 inclusive. The range(1, 11) function generates a sequence of numbers starting from 1 up to (but not including) 11.

2. On each iteration of the loop, the print('hello world') statement is executed.

Because the loop iterates 10 times, "hello world" will be printed 10 times, each on a new line.

Here is the code:

for i in range(1, 11):
print('hello world')

Output
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world

#ForLoop

@python_pioneers
@python_pioneers
👍4🥰21
Everyone Has a Story in Life

A 24 year old boy seeing out from the train’s window shouted…

“Dad, look the trees are going behind!”

Dad smiled and a young couple sitting nearby, looked at the 24 year old’s childish behavior with pity, suddenly he again exclaimed…

“Dad, look the clouds are running with us!”

The couple couldn’t resist and said to the old man…

“Why don’t you take your son to a good doctor?” The old man smiled and said…“I did and we are just coming from the hospital, my son was blind from birth, he just got his eyes today.”

Every single person on the planet has a story. Don’t judge people before you truly know them. The truth might surprise you.

መልካም ምሽት!

#EnglishStory

@python_pioneers
@python_pioneers
5👍1🥰1
Forwarded from TIKVAH-MAGAZINE
#ጥቆማ

የኢንፎርሜሽን መረብ ደህንነት አስተዳደር (ኢንሳ) በሀገር አቀፍ ደረጃ እድሜአቸው ከ11 አመት በላይ ለሆኑ እና ፍላጎት ላላቸው የሳይበር ክህሎት የስልጠና ምዝገባ እና የቻሌንጅ መርሃግብር መጀመሩን በሰጠው ጋዜጣዊ መግለጫ ገልጿል።

ተቋሙ በሁሉም የሀገሪቱ ክፍል ያሉ ወጣቶችን መመዝገብ የሚችሉ መሆኑን የገለፀ ሲሆን በሀገር አቀፍ ደረጃ የሚመዘገቡ ሰልጣኞችን  ደረጃ በደረጃ የሚመለምልበት ፈተና (ቻሌንጅ) እና ክህሎታቸውን የሚለይበት ሳይንሳዊ መስፈርት ማዘጋጀቱን ተገልጿል።

ተቋሙ የሚሰጣቸው የስልጠና መስኮች ምንድናቸው ናቸው?

- በሳይበር ደህንነት፣
- በሳይበር ደህንነት ዘርፍ የድረገፅ፣ የመተግበሪያ እና ተያያዥ ልማት (development)፣
- የስማርት ፕሮጀክት ሲስተሞች ፣
- በኤሮስፔስ እና ሎሎችም እንደሆኑ ተገልጿል።

ስልጠናው በአዲስ አበባ ዩኒቨርሲቲ ቴክኖሎጂ ለአንድ ወር ይሰጣል የተባለ ሲሆን አመልካቾች በዌብሳይት  https://talent.Insa.gov.et በመግባት እስከ ግንቦት 30/ 2016 ዓ/ም መመዝገብ እንድትችሉ ጥቆማ ቀርቧል።

ለበለጠ መረጃ +251904311833 +251943579970

+251904311837

@TikvahethMagazine
FLOW CONTROL : WHILE LOOP

ዛሬ ማታ ከባለፈው ትምህርት የቀጠለ በPython ስለ While loop እንማራለን።

Stay tuned!

⏱️ 8 : 00 PM EAT

@python_pioneers
@python_pioneers
👍1
What is a While Loop?

የተወሰነ ሁኔታ እውነት እስከሆነ ድረስ በፓይዘን ውስጥ ለተወሰነ ጊዜ loop በተደጋጋሚ የኮድ እገዳን ይፈጽማል። ጥቅም ላይ የሚውለው የድግግሞሽ ብዛት አስቀድሞ በማይታወቅበት ጊዜ እና አንዳንድ ሁኔታዎች በሚሟሉበት ጊዜ ነው.

While loop በPython አንድን block of code specify የተደረገው condition እውነት እስከሆነ ድረስ repeatedly(በተደጋጋሚ) execute የሚያረግ የ Python flow control አይነት ነው። While loopን የምንጠቀመው number of iteration ለማይታወቅባቸው ወይም executionአቸው on some condition ላይ depend ለሚሆንባቸው blocks of code ነው።

Syntax of While Loop

የ While loop basic syntax ይሄንን ይመስላል:

while condition:
# Code block to be executed

- condition: አንድ condition እውነት ወይም ሀሰት እንደሆነ evaluate የሚያረግ expression ነው።

- Code block: ይሄ ደግሞ specified የሆነው condition True በሆነ ቁጥር execute የሚደረግ የstatements ስብስብ ነው።

Flowchart of a While Loop

1. Evaluate the condition.
2. If the condition is true, execute the code block.
3. Re-evaluate the condition.
4. If the condition is still true, repeat the code block.
5. Continue until the condition becomes false.


to be cont'd...

#WhileLoop

@python_pioneers
@python_pioneers
1
...cont'd

ምሳሌ:
በዚህ ምሳሌ የምናየው program ከ 1 እስከ 5 ያሉ ቁጥሮችን print የሚያረግ ነው:

i = 1
while i <= 5:
print(i)
i += 1 # Increment the value of i by 1

Detailed Explanation

1. Initialization: i is initialized to 1 ማለትም i የሚባል variable initial valueውን አንድ አርገናል።

2. Condition Check: i <= 5 check ይደረጋል: conditionኡ እውነት ከሆነ loopኡ ይቀጥላል otherwise loopኡ terminate ያረጋል።

3. Body of Loop: print(i) የ variable 'i' ን current value print ያረጋል።

4. Increment: i is incremented by 1 using i += 1.
Increment ማለት የአንድን variable value በሆነ ያህል አማውንት መጨመር ማለት ነው፣ በላይኛው case each time the variable 'i' is being incremented by 1.

5. Re-evaluation: The condition i <= 5 is checked again with the new value of i.

If you have understood about while loop from the above two posts, answer these questions given below.

#WhileLoop

@python_pioneers
@python_pioneers
1👍1
5. How is the condition in a while loop written in Python?
Anonymous Quiz
20%
A. if condition:
68%
B. while condition:
4%
C. until condition:
8%
D. for condition in range:
Comment your answers from now on...

6. What is the output of the following code?

i = 0
while i < 3:
print(i)
i += 1

A) 0 1 2

B) 0 1 2 3

C) 1 2 3

D) 0 1
7. How many times will "Hello, World!" be printed?

count = 5
while count > 0:
print("Hello, World!")
count -= 1

A) 6

B) 5

C) 4

D) Infinite
8. What will be the value of sum after the execution of the following code?

sum = 0
i = 1
while i <= 5:
sum += i
i += 1

A) 10

B) 15

C) 20

D) 5
9. What is the purpose of the following while loop?

n = 10
while n > 0:
n -= 1

A) To count up from 1 to 10

B) To count down from 10 to 1

C) To count down from 10 to 0

D) To count up from 0 to 10
10. What will be the output of the following code?

x = 0
while x < 4:
x += 1
print(x)

A) 0 1 2 3

B) 1 2 3 4

C) 0 1 2 3 4

D) 1 2 3
👍1
ሁላችሁንም ስለተሳትፏችሁ በጣም እናመሰግናለን!

በቴክኖሎጂው ዘርፍ ብቁ የሆነ ትውልድ ማፍራት ነጌ ላይ አድጋ ልናያት የምንፈልጋትን ኢትዮጵያ ለመገንባት ዋነኛ አማራጭ ነው።

መልካም ምሽት!

@python_pioneers
@python_pioneers
2👍1🙏1
👍2
Infinite Loop

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
👍41
😂😂😂😂😂😂😂😂😂

-> @lewtayew

#Fun

@python_pioneers
😁4👍1