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
Story Time

Please read it patiently!

A Wise Manโ€™s Jokes:

A wise man once faced a group of people who were complaining about the same issues over and over again. One day, instead of listening to the complaints, he told them a joke and everyone cracked up laughing.

Then, the man repeated the joke. A few people smiled.

Finally, the man repeated the joke a third timeโ€“but no one reacted.

The man smiled and said, โ€œYou wonโ€™t laugh at the same joke more than once. So what are you getting from continuing to complain about the same problem?โ€

The Moral:

Youโ€™re not going to get anywhere if you keep complaining about the same problem but do nothing to fix it. Donโ€™t waste your time complaining, expecting other people to continue to react to your complaints. Instead, take action to make a change.

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

#EnglishStories

@python_pioneers
โค4๐Ÿ‘3
แ‰ แ‰€แŒฃแ‹ญ: IF-ELSE STATEMENT IN PYTHON

Stay Tuned!

@python_pioneers
@python_pioneers
Here is the data from the survey we conducted regarding the first digital language our channel members learned.

Most of the voters learned C++ first.

147 votes so far

@python_pioneers
โค1๐Ÿ˜1
IF-ELSE STATEMENT IN PYTHON

แ‰ แ‰ฃแˆˆแˆแ‹ แ‰ตแˆแˆ…แˆญแ‰ณแ‰ฝแŠ• แˆตแˆˆ if statement in python แˆ›แˆˆแ‰ตแˆ แŠ แŠ•แ‹ต condition แˆ‹แ‹ญ แ‰ แˆ˜แˆ˜แˆตแˆจแ‰ต แ‹จconditionแŠกแŠ• Truth value แ‰ แˆ›แ‹จแ‰ต แ‹จแ‰ฐแˆˆแ‹ซแ‹ฉ code blocks run แŠฅแŠ•แ‹ตแŠ“แˆจแŒ แŠฅแŠ•แ‹ฐแˆšแˆจแ‹ณแŠ• แ‰ แ‰ตแŠ•แˆนแˆ แ‰ขแˆ†แŠ• แŠ แ‹ญแ‰ฐแŠ“แˆแฃ แ‹›แˆฌ แ‹ฐแŒแˆž แŠจแ‹› แ‹จแ‰€แŒ แˆˆแ‹แŠ• แ‰ตแˆแˆ…แˆญแ‰ต แŠฅแŠ•แˆ›แˆซแˆˆแŠ•แข

แ‹ญแˆ… แ‹จ if-else statement แˆˆ decision-making แŠจsimple if statement แ‹จแˆšแˆปแˆ แŠ แŒแˆแŒแˆŽแ‰ต แ‹ญแˆฐแŒฃแˆแข แŠจif statement แŒ‹แˆญ แ‰ แ‰ฐแˆ˜แˆณแˆณแ‹ญ แˆ˜แŠ•แŒˆแ‹ต แАแ‹ แ‹จแˆšแˆฐแˆซแ‹ แАแŒˆแˆญ แŒแŠ• แ‹จsimple if statement condition Truth value False(แˆ€แˆฐแ‰ต) แŠจแˆ†แА แˆแŠ•แˆ แАแŒˆแˆญ แŠ แŠ“แŒˆแŠแˆ(nothing will be printed) แˆ›แˆˆแ‰ตแˆ it does nothing: แАแŒˆแˆญ แŒแŠ• if-else statement แˆตแŠ•แŒ แ‰€แˆ แ‹จif condition False แŠจแˆ†แА แ‹จelse block แ‹แˆตแŒฅ แ‹ซแˆˆแ‹ expression executed แ‹ญแˆ†แŠ“แˆแข

แŠฅแˆตแŠช แ‰ แˆแˆณแˆŒ แŠฅแŠ•แ‹จแ‹:

แŠ แŠ•แ‹ต kutir แ‹จแˆšแ‰ฃแˆ variable แŠ แˆˆแŠ• แŠฅแŠ•แ‰ แˆแฃ แŠฅแŠ“แˆ แˆˆvariable assign แ‹จแ‰ฐแ‹ฐแˆจแŒˆแ‹ แ‰แŒฅแˆญ even แŠฅแŠ•แ‹ฐแˆ†แА แŠฅแŠ“แˆจแŒ‹แˆˆแŠ•แข
So here is the code for it: แˆ˜แŒ€แˆ˜แˆชแ‹ซ แˆˆvariableแŠก แ‹จแˆฐแŒ แАแ‹ value 4 แАแ‹แข แ‹จแ‰ฐแŒ แ‰€แˆแАแ‹ condition แ‹ฐแŒแˆž (kutir % 2 == 0) แАแ‹แฃ แ‹ญแˆ… แ‹ฐแŒแˆž variableแŠก แ‹แˆตแŒฅ แ‹จแ‰ฐแ‹ซแ‹˜แ‹ แ‰แŒฅแˆญ even แŠฅแŠ•แ‹ฐแˆ†แА check แˆˆแˆ›แ‹ตแˆจแŒ แАแ‹(A number is even if it is divided by two without a remainder)

Here is the code:

kutir = 4

if kutir % 2 == 0:
print("kutir is Even")


Output : kutir is Even


แŠฅแ‹šแˆ… แŒ‹แˆญ conditionแŠก แŠฅแ‹แАแ‰ต แˆตแˆˆแˆ†แА( 4 even แˆตแˆˆแˆ†แА) the block of code inside the if statement is executed in this case "kutir is Even" printed แ‹ญแˆ†แŠ“แˆแข

แŒแŠ• แŠฅแˆบ what will happen if we change the value of the variable to 3?

แ‹จvariableแŠก value 3 แŠจแˆ†แА the condition becomes False แ‹ซ แˆ›แˆˆแ‰ต the statement under if block is not executed( nothing will be printed) แˆ›แˆˆแ‰ต แАแ‹แข แŠฅแ‹šแˆ… แŒ‹แˆญ แАแ‹ แ‰ณแ‹ฒแ‹ซ else block แ‹จแˆšแ‹ซแˆตแˆแˆแŒˆแ‹แข


kutir = 3

if kutir % 2 == 0:
print("kutir is Even")


Output :

แŠจแˆ‹แ‹ญ แ‹ซแˆˆแ‹แŠ• code if-else statement แ‰ฐแŒ แ‰…แˆ˜แŠ• แŠจแƒแแАแ‹แขแ‹จ if statement condition False แˆตแˆˆแˆ†แАแฃ else block แ‹แˆตแŒฅ แ‹ซแˆˆแ‹ code executed แ‹ญแˆ†แŠ“แˆ แˆ›แˆˆแ‰ต แАแ‹แข แ‰แŒฅแˆฉ even แŠซแˆแˆ†แА "kutir is not even" แ‹จแˆšแˆ text printed แŠฅแŠ•แ‹ฒแˆ†แŠ•แˆแŠ• แŠจแˆแˆˆแŒแŠ• แŠฅแŠ•แ‹ฐแ‹šแˆ… แˆ˜แƒแ แŠฅแŠ•แ‰ฝแˆ‹แˆˆแŠ•แข

kutir = 3

if kutir % 2 == 0:
print("kutir is Even")
else:
print("kutir is not Even")


Output :kutir is not Even


3 even แˆตแˆ‹แˆแˆ†แА if block แ‹แˆตแŒฅ แ‹ซแˆˆแ‹ code แ‹ญแ‹˜แˆˆแˆแŠ“ else block แ‹แˆตแŒฅ แ‹ซแˆˆแ‹ code executed แ‹ญแˆ†แŠ“แˆ-> "kutir is not Even" printed แ‹ญแˆ†แŠ“แˆ แˆ›แˆˆแ‰ต แАแ‹แข

แ‰€แŒฃแ‹ญ: if..elif..else

PythonแŠ• แ‰ แŠ แˆ›แˆญแŠ› แŠฅแŠ•แˆ›แˆญ!

#IfElse

@python_pioneers
@python_pioneers
โšก2๐Ÿ‘2
Here are some beautiful programming related wallpapers.

Enjoy Them!โšก๏ธโšก๏ธโšก๏ธโšก๏ธ

#wallpapers

@python_pioneers
๐Ÿ”ฅ3โค1๐Ÿ‘1๐Ÿ‘Œ1
"To attract positive things in your life, start by giving off positive energy."

-Unkown

Have a nice day!

#EnglishQoutes

@python_pioneers
โค3๐Ÿ‘2
"แˆ˜แˆแŠซแˆ แ‹ซแ‹ฐแˆจแŒ‰ แ‰ฅแ‹™
แˆดแ‰ถแ‰ฝ แŠ แˆ‰ แŠ แŠ•แ‰บ แŒแŠ•
แŠจแˆแˆ‰ แ‰ตแ‰ แˆแŒซแˆˆแˆฝ"

"Many women do
noble things but
you surpass them all"

--> @nirvanaland7

แˆ˜แˆแŠซแˆ แ‹จแŠฅแŠ“แ‰ถแ‰ฝ แ‰€แŠ•!

#MothersDay
@python_pioneers
โค7๐Ÿ‘1๐Ÿ‘Ž1
if...elifโ€ฆelse statement

if...elifโ€ฆelse statement: แ‰ฅแ‹™ แŠ แˆ›แˆซแŒฎแ‰ฝ แˆŠแŠ–แˆฉแ‰ต แ‹จแˆšแ‰ฝแˆ แ‹ˆแ‹ญแˆ แ‰ฅแ‹™ conditions แ‹จแˆšแˆแˆแŒ problem แŠซแˆˆ แ‹ญแˆ„แŠ• แˆ˜แŠ•แŒˆแ‹ต แŠฅแŠ•แŒ แ‰€แˆ›แˆˆแŠ• แข

แ‰ แ‰ฐแˆ›แˆช แ‹แŒคแ‰ต แˆ‹แ‹ญ แ‰ แˆ˜แˆ˜แˆตแˆจแ‰ต 'Excellent, Very Good, Good, Satisfactory, or Failโ€™ แ‰ฅแˆŽ print แ‹จแˆšแ‹ซแˆจแŒ program แˆˆแˆ˜แˆตแˆซแ‰ต แŠ แˆตแ‰ แŠ“แˆ แŠฅแŠ•แ‰ แˆแข

แ‰ แŠฅแŠ•แ‹ฐแ‹šแˆ… แ‹“แ‹ญแАแ‰ต แˆแŠ”แ‰ณแ‹Žแ‰ฝ แฃ แ‹จแˆแˆˆแŒแАแ‹แŠ• แ‹ซแˆ…แˆ elif statement แ‰ฐแŒ แ‰…แˆ˜แŠ• แˆˆแ‰ฐแˆˆแ‹ซแ‹ฉ conditions แ‹จแ‰ฐแˆˆแ‹ซแ‹ฉ executions แŠฅแŠ•แ‹ฒแŠ–แˆฉแ‰ต PythonแŠ• แ‰ แˆ˜แŒ แ‰€แˆ แˆ›แ‹ตแˆจแŒ แŠฅแŠ•แ‰ฝแˆ‹แˆˆแŠ•แข

else is the same as else and if combined together

Multiple if's means your code would go and check all the if conditions, where as in case of elif, if one if condition satisfies it would not check other conditions..

แ‹จ elif keyword แ‰ Python interpreterแŠกแŠ• "แŠจแ‹šแˆ… แ‰€แ‹ฐแˆ แ‹ซแˆˆแ‹ condition(s) แŠฅแ‹แАแ‰ต แŠซแˆแˆ†แА/แŠ‘ แ‹ญแˆ„แŠ›แ‹แŠ• แˆžแŠญแˆญ" แŠฅแŠ•แ‹ฐแˆ›แˆˆแ‰ต แАแ‹แข or " else...if" แˆ›แˆˆแ‰ต แАแ‹แข

แ‰ แˆแˆณแˆŒ แŠฅแŠ•แ‹จแ‹:

Pseudocode:

if condition1:
#statement to execute if condition1 is true
elif condition2:
#statement to execute if condition2 is true
else:
#statement to execute if both conditions are false

แ‹จแˆ˜แŒ€แˆ˜แˆชแ‹ซแ‹ condition true แŠจแˆ†แА, แ‰ if block แ‹แˆตแŒฅ แ‹ซแˆˆแ‹ statement executed แ‹ญแˆ†แŠ“แˆแข

แ‹จแˆ˜แŒ€แˆ˜แˆชแ‹ซแ‹ condition false แŠจแˆ†แА , แ‰€แŒฃแ‹ฉ elif condition check แ‹ญแ‹ฐแˆจแŒ‹แˆแข

แ‹จelif condition true แŠจแˆ†แА, แ‰ elif block แ‹แˆตแŒฅ แ‹ซแˆˆแ‹ statement executed แ‹ญแˆ†แŠ“แˆแข

แˆแˆˆแ‰ฑแˆ conditions false แŠจแˆ†แŠ‘ แ‹ฐแŒแˆž , แ‰ else block แ‹แˆตแŒฅ แ‹ซแˆˆแ‹ statement executed แ‹ญแˆ†แŠ“แˆแข

...แ‹ญแ‰€แŒฅแˆ‹แˆ

#Condional

@python_pioneers
แ‰ แ‰€แŒฃแ‹ญ elif statement แ‰ แˆ˜แŒ แ‰€แˆ แ‹จแ‰ฐแˆ›แˆชแŠ•๐Ÿ‘จโ€๐Ÿ’ป๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐ŸŽ“ Performance แˆ˜แˆฐแˆจแ‰ต แ‰ แˆ›แ‹ตแˆจแŒ grade แŠฅแŠ•แ‹ตแŠ•แˆฐแŒฅ แ‹จแˆšแ‹ซแˆตแ‰ฝแˆˆแŠ•แŠ• program แŠฅแŠ•แ‹ดแ‰ต แˆ˜แƒแ แŠฅแŠ•แ‹ฐแˆแŠ•แ‰ฝแˆ แŠฅแŠ“แ‹ซแˆˆแŠ•แข

โญ๏ธ
แ‹จPythonแŠ• elif statement แ‰ แˆ˜แŒ แ‰€แˆ แˆŠแ‰€แˆจแ แ‹จแˆšแ‰ฝแˆ real-life problem แ‰ขแŠ–แˆญ Grading system แАแ‹แข

Here's an example:

# Program to calculate the grade of a student based on their exam score

# declaring a variable to store exam score
exam_score = 87

# Calculate grade based on exam score
if exam_score >= 90:
grade = "A"
elif exam_score >= 80:
grade = "B"
elif exam_score >= 70:
grade = "C"
elif exam_score >= 60:
grade = "D"
else:
grade = "F"

# Display the grade
print("The grade for the exam score of ", exam_score, "is", grade)

แ‰ แ‹šแˆ… program, exam_score variable แ‹จแ‰ฐแˆ›แˆชแ‹แŠ• แ‹แŒคแ‰ต แŠจแˆ˜แ‰ถ แ‹ญแ‰€แ‰ แˆ‹แˆ(แ‹ˆแ‹ญแˆ user-input แŠฅแŠ•แ‹ฒแ‰€แ‰ แˆ แˆ›แ‹ตแˆจแŒ แŠฅแŠ•แ‰ฝแˆ‹แˆˆแŠ• แ‹ญแˆ… แ‹ฐแŒแˆž for multiple scores grade check แŠฅแŠ•แ‹ตแŠ“แˆจแŒ แ‹ญแˆจแ‹ณแŠ“แˆ) แŠจแ‹›แˆ programแŠก แ‰ แ‹แŒคแ‰ฑ แˆแŠญ grade แ‹ญแˆฐแŒ แŠ“แˆแข

The elif statements help determine the appropriate grade based on different score ranges. Finally, the grade is displayed.

โ“แŒฅแ‹ซแ‰„ แŠซแˆ‹แ‰ฝแˆ แˆ˜แŒ แ‹จแ‰… แ‰ตแ‰ฝแˆ‹แˆ‹แ‰ฝแˆ

โญ๏ธแ‰ แ‰€แŒฃแ‹ญ input แŠจ user แŠฅแŠ•แ‹ดแ‰ต แˆ˜แ‰€แ‰ แˆ แŠฅแŠ•แ‹ฐแˆแŠ•แ‰ฝแˆ แŠฅแŠ•แˆ›แˆซแˆˆแŠ•

แ‰ตแˆแˆ…แˆญแ‰ถแ‰นแŠ• แŠจแ‹ˆแ‹ฐแ‹ณแ‰ฝแŠ‹แ‰ธแ‹ แ‰ ๐Ÿ‘ แŒแˆˆแแˆแŠ•

#elif
#example

@python_pioneers
@python_pioneers
๐Ÿ‘8๐Ÿฅฐ1