Python Pioneers: A Beginner's Guide ๐Ÿ‡ช๐Ÿ‡น
8.82K 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
3. What is the output of the following code snippet:

for i in range(2, 8, 2): print(i)
Anonymous Quiz
25%
a) 2, 3, 4, 5, 6, 7
69%
b) 2, 4, 6
6%
c) 3, 5, 7
0%
d) 2, 5
๐Ÿ‘1
4. In Python, what is the default step value for the range function if not specified?
Anonymous Quiz
61%
a) 1
6%
b) 2
24%
c) 0
9%
d) The step value must always be specified
Perceptive:

Two twin boys were raised by an alcoholic father. One grew up to be an alcoholic and when asked what happened, he said โ€œI watched my father."

The other grew up and never drank in his life. When asked what happened, he said โ€œI watched my father."

Two boys, same dad, two different perspectives.

Your perspective in life will determine your destination.

GOOD NIGHT!

#EnglishStories

@python_pioneers
@python_pioneers
โค5๐Ÿ‘2๐Ÿฅฐ1
1โƒฃ
FOR LOOP

โ“What will be the output of the above code?

Comment your answer!

@python_pioneers
โค1
Description 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๐Ÿฅฐ2โค1
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