Python Pioneers: A Beginner's Guide 🇪🇹 – Telegram
Python Pioneers: A Beginner's Guide 🇪🇹
8.87K 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
OPERATIONS IN PYTHON

Here are some of the fundamental operations in python. Mathematics ላይ ካየን there are operations like addition , subtraction... እነዚህን operations Arithmetic operations እንላቸዋለን፣ Python ግን Arithmetic operations ላይ የተገደበ አይደለም፣ There are lots of operations.

Operands: Operands are the values or variables on which an operator acts. In other words, operands are the data that are manipulated by an operator in an expression.

ለምሳሌ፡ In the expression 5 + 3, the _operands_ are the numbers 5 and 3, while the plus sign (+) is the _operator_ that acts on the _operands_ to perform the addition operation.

በ Python ደግሞ operands variables, constants, ወይም expressions ሊሆኑ ይችላሉ።

1. Arithmetic Operations:

- Addition (+): ሁለት ቁጥሮችን ለመደመር የምንጠቀመው type of operation ነው።.

- Subtraction (-): ከመጀመሪያው ቁጥር ሁለተኛውን ለመቀነስ የሚያገለግል operation ነው።

- Multiplication (*): ይህኛው ደግሞ ሁለት operands ለማባዛት፡

- Division (/): የመጀመሪያውን ቁጥር በሁለተኛው ቁጥር ለማካፈል ያገለግላል(The result is always a float).

- Modulus (%): Returns the remainder of the division(ቀሪ return ያረጋል)

- Exponentiation (**): Raises the first operand to the power of the second.
x**y ማለት x to the power of y እንደ ማለት ነው።

- Floor Division (//): Returns the quotient without the remainder(ክፍልፋይ ያለ ቀሪ return ያረጋል)

Code Example:

a = 10
b = 5
addition = a + b # result = 15

subtraction = a - b # result = 5

multiplication = a * b # result = 50

division = a / b # result = 2.0

modulus = a % b # result = 0 since the rem is 0

exponentiation = a ** b # result = 100000

floor_division = a // b # result = 2

2. Comparison Operations:

እነዚህ operations ደግሞ ሁለት values(operands) compare በማድረግ boolean value return ያረጋሉ (True or False) based on on the comparison result.

- Equal (==): Checks if two operands are equal.

- Not Equal (!=): Checks if two operands are not equal.

- Greater Than (>): Checks if the first operand is greater than the second.

- Less Than (<): Checks if the first operand is less than the second.

- Greater Than or Equal To (>=): Checks if the first operand is greater than or equal to the second.

- Less Than or Equal To (<=): Checks if the first operand is less than or equal to the second.

Code Example:

x = 10
y = 5
equal = x == y # result = False since 10 != 5

not_equal = x != y # result = True since 10 != 5

greater_than = x > y # result = True since 10 > 5

less_than = x < y # result = False since 10 > 5

greater_than_or_equal_to = x >= y # result = True

less_than_or_equal_to = x <= y # result = False

...ይቀጥላል

@python_pioneers
@python_pioneers
👍4👏2
...contd

3. Logical Operations:

The operands here are boolean values (True and False).

- AND (and): Returns True if both operands are true.

- OR (or): Returns True if any of the operands are true.

- NOT (not): Returns True if the operand is false.

Code Example:

p = True
q = False
and_result = p and q # result = False
or_result = p or q # result = True
not_result = not p # result = False

4. Assignment Operations:
እነዚህ ደግሞ አንድን value ለvariable assign ለማድረግ ነው የምንጠቀመው።

+= : በቀኝ በኩል ያለውን operand በግራ በኩል ባለው operand ላይ ይደምርና ውጤቱን በግራ በኩል ላለው operand assign ያረገዋል።

-= : በቀኝ በኩል ያለውን operand ከግራው በመቀነስ ውጤቱን በግራ በኩል ላለው operand assign ያረጋል።


*= : በግራ በኩል ያለውን operand በቀኝ በኩል ባለው ያባዛና ውጤቱን በግራ በኩል ላለው operand assign ያረጋል።

/= : በግራ በኩል ያለውን operand በቀኝ በኩል ባለው operand ያካፍልና ውጤቱን በግራ በኩል ላለው operand assign ያረገዋል።

Code Example:
x = 5
x += 3 # Equivalent to x = x + 3
x -= 2 # Equivalent to x = x - 2
x *= 4 # Equivalent to x = x * 4
x /= 2 # Equivalent to x = x / 2

These are just some of the basic operations in python, we believe you have grasped some knowledge about them.


@python_pioneers
@python_pioneers
👍31
GROW THROUGH WHAT YOU GO THROUGH.

የሚያጋጥመን ማንኛውም ፈተና እና መሰናክል ለመማር፣ ለማደግ እና ለመጠንከር እድል ይሰጠናል። በሚያጋጥሙን ችግሮች ከመማረር ወይም ከመናደድ ይልቅ ለself development እና እራሳችንን ለማሻሻል እንደ እድል አድርገን መቀበል አለብን።

መልካም ምሽት!

@python_pioneers
👍5🥰2
COMMENTS IN PYTHON

Pythonን በአማርኛ እንማር!

Stay Tuned!
@python_pioneers
👍2
Python Pioneers: A Beginner's Guide 🇪🇹
COMMENTS IN PYTHON Pythonን በአማርኛ እንማር! Stay Tuned! @python_pioneers
COMMENTS IN PYTHON

በPython፡ Comments በPython interpreter ignore የሚደረጉ ማብራሪያዎች ናቸው። የፃፍነውን code purpose ለመግለፅ፣ እንዴት እንደሚሰራ፣ እና ሌሎች መረጃዎችን ለመፃፍ እንጠቀማቸዋለን። Comments are crucial for code readability and maintenance

TYPES OF COMMENTS IN PYTHON፡-

1. Single-Line Comments፡ እነዚህ comments በ# ምልክት ይጀምራሉ እና እስከ line መጨረሻ ድረስ ይቀጥላሉ ። እነዚህን ደግሞ ለአጫጭር ማብራሪያዎች እንጠቀማቸዋለን።

    # This is a single-line comment
x = 5 # This is also a single-line comment

2. Multi-Line Comments፡ በPython ፣ ለMulti-line comments specific syntax የለም። ነገር ግን አብዛኛውን ጊዜ multi-line comments ለመፍጠር triple qoutes(ሶስት ትምህርተ ጥቅስ)(''' ወይም """) መጠቀም እንችላለን።

    '''
This is a multi-line comment.
It spans across multiple lines.
'''

3. Docstrings፡ Docstrings፡ functions, modules, እና classes document ለማድረግ ይጠቅማሉ። They are enclosed in triple quotes and provide more detailed explanations of the purpose, parameters, and return values of functions.

ለምሳሌ ይሄንን code እንመልከት፡

    def add_numbers(a, b):
"""
This function adds two numbers together.

Parameters:
a (int): The first number.
b (int): The second number.

Returns:
int: The sum of a and b.
"""
return a + b

እናም in general comments in any programming languages የሚያገለግሉት የፃፍነው code በምን ዓይነት መንገድ እንደሚሰራ ለመግለፅ ነው፣ የፃፍነውን code ደግሞ ለላ ሰው እንዲያየው share የምናረግ ከሆነ የሚያነበው ሰው የበለጠ ስለ programኡ አሰራር እንዲረዳ ያደርጋል።

@python_pioneers
👍3
There is no straight path to success. The problems we face have the ability to shape us. Grow through them.

HARD WORK
|
|
PROBLEM
|
SETBACK
|
FAILURE
|
CHALLENGE
|
OBSTACLE
|
|
SUCCESS

Have a nice day!

@python_pioneers
👍1
Let's Revise what we have been learning with these questions.
👇👇👇👇👇👇👇👇👇
1. What is the correct way to declare a variable in Python?
Anonymous Quiz
7%
A. var x = 5
66%
B. x = 5
25%
C. int x = 5
2%
D. declare x as 5
3. What type of operations can you perform on variables in Python?
Anonymous Quiz
12%
A. Mathematical operations
6%
B. String operations
0%
C. Logical operations
82%
D. All of the above
🔈New Subscribers

Welcome!

It is good for you if you scroll up and see the previous lessons we have been learning.

Also don't forget to invite your friends ,who are interested in programming, to our channel.

@python_pioneers
Python Pioneers: A Beginner's Guide 🇪🇹 pinned «🔈New Subscribers Welcome! It is good for you if you scroll up and see the previous lessons we have been learning. Also don't forget to invite your friends ,who are interested in programming, to our channel. @python_pioneers»
1⃣0⃣1⃣0⃣1⃣1⃣0⃣1⃣0⃣1⃣1⃣0⃣1⃣1⃣1⃣0⃣1⃣0⃣
Test your knowledge about arithmetic operations in python with these easy questions
1. What is the result of 10 + 5 in Python?
Anonymous Quiz
3%
A) 13
91%
B) 15
6%
C) 17
0%
D) 20
2. What is the result of 25 - 9 in Python?
Anonymous Quiz
0%
A) 12
9%
B) 15
86%
C) 16
5%
D) 20
3. What is the result of 6 * 4 in Python?
Anonymous Quiz
2%
A) 22
94%
B) 24
3%
C) 26
2%
D) 28
4. What is the result of 16 / 4 in Python?
Anonymous Quiz
3%
A) 2.5
3%
B) 3.0
94%
C) 4.0
0%
D) 5.2
5. What is the result of 18 % 7 in Python?
Anonymous Quiz
11%
A) 1
21%
B) 2
12%
C) 3
56%
D) 4