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
FOR LOOP

For loopแŠ• แ‰  Python แ‹จแˆแŠ•แŒ แ‰€แˆ˜แ‹ แ‹จแˆ†แАแŠ• line of code แ‹ˆแ‹ญแˆ แŠฅแŠ•แ‹ฐ list, tuple, string, range, numbers... แ‹จแˆ˜แˆณแˆฐแˆ‰ sequence of elements แ‰ แ‰ฐแ‹ฐแŒ‹แŒ‹แˆš execute แˆˆแˆ›แˆจแŒ แАแ‹แข แ‹ญแˆ… แ‹ฐแŒแˆž แ‰ sequenceแŠก แŠฅแ‹ซแŠ•แ‹ณแŠ•แ‹ฑ item แˆ‹แ‹ญ แ‰ฐแˆ˜แˆณแˆณแ‹ญ operation แŠฅแŠ•แ‹ตแŠ“แŠซแˆ„แ‹ต แ‹ญแˆจแ‹ณแŠ“แˆแข

แ‰ Python แ‹จfor loop basic syntax แ‹ญแˆ„แŠ• แ‹ญแˆ˜แˆตแˆ‹แˆ:


for item in sequence:
# do something with item

แ‰ syntaxแŠก แ‹แˆตแŒฅ:

- "item" แ‹จแˆšแˆˆแ‹ แ‰ แŠฅแ‹ซแŠ•แ‹ณแŠ•แ‹ฑ Iteration(แ‹ตแŒแŒแˆžแˆฝ) แ‹จsequenceแŠกแŠ• every item แ‹ญแ‹ˆแŠญแˆ‹แˆ(placeholder variable แАแ‹แข)

- "sequence" แ‹จแˆšแˆˆแ‹ แ‹ฐแŒแˆž แ‹จแˆšแ‹ˆแŠญแˆˆแ‹ loopแŠก iterate แ‹จแˆšแ‹ซแˆจแŒแ‰ฃแ‰ธแ‹ elements of sequenceแŠ• แАแ‹แข

แŠฅแˆตแŠช แŠจแˆ‹แ‹ญ แ‹ซแˆˆแ‹แŠ• แˆ€แˆณแ‰ฅ แ‰ แˆแˆณแˆŒ แŠฅแŠ•แ‹จแ‹แฃ แ‰ แˆแˆณแˆŒแ‹ แ‹ฐแŒแˆž แ‹จแˆ†แА แ‹จแ‰แŒฅแˆฎแ‰ฝ แˆตแ‰ฅแˆตแ‰ฅ แŠ แˆˆ แฃ แŠจแ‹›แˆ แ‰ listแŠก iterate แŠฅแ‹ซแˆจแŒˆ แŠฅแ‹ซแŠ•แ‹ณแŠ•แ‹ฑแŠ• แ‰แŒฅแˆญ print แ‹จแˆšแ‹ซแ‹ฐแˆญแŒ program แˆˆแˆ˜แƒแ แŠฅแŠ•แˆžแŠญแˆซแˆˆแŠ•แข

We will learn deeply about lists in the future...

numbers = [1, 2, 3, 4, 5]

for num in numbers:
print(num)

This would output:
1
2
3
4
5



...to be continued

#ForLoop

@python_pioneers
@python_pioneers
๐Ÿ‘4๐Ÿฅฐ1
... continued

For loopแŠ• แŠจrange() functionแˆ แŒ‹แˆญ แˆ˜แŒ แ‰€แˆ แŠฅแŠ•แ‰ฝแˆ‹แˆˆแŠ•แฃ แ‰ แ‹šแˆ… แ‹ฐแŒแˆž แ‹จแˆ†แŠ‘ range of numbers แˆ‹แ‹ญ iterate แŠฅแŠ“แˆจแŒ‹แˆˆแŠ•แข

แ‹จ range() function Python built-in function แˆฒแˆ†แŠ• sequence of numbers แŠฅแŠ•แ‹ตแŠ•แˆแŒฅแˆญ แ‹ญแˆจแ‹ณแŠ“แˆแข แŠฅแŠ“แˆ แŠจfor loop แŒ‹แˆญ แ‰ฐแŒ แ‰…แˆ˜แŠ• over the sequence of numbers iterate แˆ›แ‹ตแˆจแŒ แŠฅแŠ•แ‰ฝแˆ‹แˆˆแŠ•แข

แ‹จ range() function syntax แ‹ญแˆ„แŠ• แ‹ญแˆ˜แˆตแˆ‹แˆแก

range(start, stop, step)

- start is the starting number of the sequence (optional, default is 0)

-
stop is the ending number of the sequence (required)

-
step is the difference between each number in the sequence (optional, default is 1)

แˆแˆณแˆŒ 1: แ‰ range function แŠจ0-9 แ‰แŒฅแˆฎแ‰ฝแŠ• แˆˆแˆ›แ‹แŒฃแ‰ต แŠจแˆแˆˆแŒแŠ•แก range(9) แˆ›แˆˆแ‰ต แŠฅแŠ•แ‰ฝแˆ‹แˆˆแŠ•แข

แˆแˆณแˆŒ 2:

for kutir in range(1, 6):
print(kutir)


This would output:
1
2
3
4
5

...to be continued

@python_pioneers
@python_pioneers
@python_pioneers
๐Ÿ‘6๐Ÿ”ฅ1
"You can't go back and change the beginning, but you can start where you are and change the ending."

-C.S. Lewis

แŒธแŒธแ‰ต แ‹แˆตแŒฅ แˆ˜แŒแ‰ฃแ‰ณแ‰ฝแŠ• แŠฅแŠ“ แ‰ แŒแ‹œ แ‹ˆแ‹ฐ แŠ‹แˆ‹ แˆ„แ‹ฐแŠ• แˆแŠ“แ‹ฐแˆญแŒ‹แ‰ธแ‹ แ‹จแˆแŠ•แ‰ฝแˆ‹แ‰ธแ‹แŠ• แАแŒˆแˆฎแ‰ฝ แ‹ซแˆˆแˆ›แ‰‹แˆจแŒฅ แˆ›แˆฐแ‰ฅ แ‰€แˆ‹แˆ แАแ‹แข แАแŒˆแˆญ แŒแŠ• แ‹ซแˆˆแˆแ‹ แАแŒˆแˆญ แˆ‹แ‹ญ แˆ˜แ‰†แ‹จแ‰ณแ‰ฝแŠ• แˆแŠ•แˆ แŠ แ‹ญแŒ แ‰…แˆ˜แŠ•แˆแข แ‹ˆแ‹ฐ แŠ‹แˆ‹ แ‰ฐแˆ˜แˆแˆฐแŠ• แ‹จแˆ†แАแ‹แŠ•(แ‹จแˆฐแˆซแŠ“แ‰ธแ‹แŠ• แˆตแˆ…แ‰ฐแ‰ถแ‰ฝ) แˆ˜แˆˆแ‹ˆแŒฅ แŠ แŠ•แ‰ฝแˆแˆ แАแŒˆแˆญ แŒแŠ• แŠ แˆแŠ• แŒ€แˆแˆจแŠ• แ‰ฅแŠ•แ‰ณแˆจแˆ แˆˆแ‹แŒฅ แˆ›แˆแŒฃแ‰ต แŠฅแŠ•แ‰ฝแˆ‹แˆˆแŠ•แข

แˆ˜แˆแŠซแˆ แˆแˆฝแ‰ต!

#Quotes

@python_pioneers
@python_pioneers
๐Ÿ”ฅ4โค3๐Ÿ’ฏ1
Forwarded from ๐”‰๐–Ž๐–™๐–” ๐–’๐–†๐–“
https://t.me/tapswap_mirror_bot?start=r_5685218492
๐ŸŽ +2.5k Shares as a first-time gift
๐Ÿ‘1๐Ÿฅฐ1
PYTHON PIONEERS

Begin your coding journey with us! Join our Telegram and YouTube channels and start learning programming in Amharic today.

Start now and unlock endless possibilities with us.

Let's code together!

@python_pioneers
@python_pioneers
๐Ÿ‘4โค1๐Ÿ”ฅ1
Python Range Function
range()

Practice Problems

โญ๏ธ
1. What does the following code snippet do in Python?

for i in range(5): print(i)
Anonymous Quiz
57%
a) Prints numbers from 0 to 4
5%
b) Prints numbers from 1 to 5
23%
c) Prints numbers from 0 to 5
15%
d) Prints numbers from 1 to 4
2. What is the correct syntax for using the range function with a start, end, and step value specified?
Anonymous Quiz
46%
a) range(start, end, step)
19%
b) range(start:end:step)
32%
c) range(start, step, end)
3%
d) range(end, start, step)
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