Being youthful is not just about age, but about being useful in every moment.
แแฃแตแแต แแฅแต แแแฃ แฅแแแ แฅแแญ แฒแแฅแจแ แญแแแ แแฅแต แ แฅแซแแณแแณแฝแ แแตแฅ แ แตแแแงแแข แญแ แแฅแต แฐแแ แ แ แแณแ แแแฎแฝ แแฃแจแ แจแแ แตแแฃ แ แซแณแแต แแตแแ แ แแญแจแฃ แแแญ แแญ แ แแแแแข แฅแซแแณแแทแ moment invest แ แญแแ แแฃแตแแณแฝแแ แแแแซแ แแแญ แฅแแแแแข
แแแซแ แแ!
YOUTHFUL IS USEFUL!
@python_pioneers
แแฃแตแแต แแฅแต แแแฃ แฅแแแ แฅแแญ แฒแแฅแจแ แญแแแ แแฅแต แ แฅแซแแณแแณแฝแ แแตแฅ แ แตแแแงแแข แญแ แแฅแต แฐแแ แ แ แแณแ แแแฎแฝ แแฃแจแ แจแแ แตแแฃ แ แซแณแแต แแตแแ แ แแญแจแฃ แแแญ แแญ แ แแแแแข แฅแซแแณแแทแ moment invest แ แญแแ แแฃแตแแณแฝแแ แแแแซแ แแแญ แฅแแแแแข
แแแซแ แแ!
YOUTHFUL IS USEFUL!
@python_pioneers
๐4โค3
The Python Interpreter
Interpreter แแญแ แ แ แแญแ แฐแญแแ แแแแ แฅแแฝแแแแฃ แ High-level programming language แจแแแแแ code แแฐ machine language แจแแแญแญ program แฅแแฐแแ แ แญแฐแ แแ แญแข แแแ แฐแแ Python interpreted language แฅแแฐแแแ แญแแญ แ แญแฐแแแข
แจPythonแ language in our devices แตแแญแ แจแฐแซแแต แแแฎแฝ แ แแฑ Python interpreter แแแข Python interpreter แจPython Programming statements แแแ แฅ แฅแ แฅแแฑแ execute แแตแจแ แจแแฝแ แแฎแแซแ แแแข Interpreterแกแ แ แแแต แ แญแแต แแแแถแฝ แแ แแ แฅแแฝแแแแก
I.Interactive mode แฅแ
II.Script mode
In Interactive mode, Interpreterแก แฅแ python statements keyboard แแญ แฅแตแจแแแ แ แญแ แฅแแแข แ แแต แแ แ แแต valid แจแแ statement แจแแแ execute แซแจแแ waits for another statement.
In Script mode, Interpreterแก python statements แจแซแ file แแตแฅ แซแแตแ contents แ แแต แ แ แแต แซแแฃแธแแแข
แญแ file แฐแแ python program แแญแ python script แญแฃแแแข Interpreterแก each statement แฃแแ แ แแฅแญ execute แซแจแแธแแแข
Interactive Mode
Python interpreter แจแแ operating system แแตแฅ แจแซแแ แ แแ แแฐ command-line แ แแแต Interpreterแกแ แ Interactive mode แแจแ แฅแแฝแแแแข with the following command:
When the Python interpreter starts in interactive mode, แฅแแฐแแ แ แญแแต แแแญ displayed แญแแแแข
แญแ แแ๐ แแแญแต แจแแซแณแจแ Interpreterแก แจแแ แแแญ แฅแแตแตแ แ แฅแจแ แ แ แแแแ แจแแตแ แแตแ python statement execute แแแจแ ready แฅแแฐแแ แแแข๐
...แญแแฅแแ
@python_pioneers
@python_pioneers
Interpreter แแญแ แ แ แแญแ แฐแญแแ แแแแ แฅแแฝแแแแฃ แ High-level programming language แจแแแแแ code แแฐ machine language แจแแแญแญ program แฅแแฐแแ แ แญแฐแ แแ แญแข แแแ แฐแแ Python interpreted language แฅแแฐแแแ แญแแญ แ แญแฐแแแข
แจPythonแ language in our devices แตแแญแ แจแฐแซแแต แแแฎแฝ แ แแฑ Python interpreter แแแข Python interpreter แจPython Programming statements แแแ แฅ แฅแ แฅแแฑแ execute แแตแจแ แจแแฝแ แแฎแแซแ แแแข Interpreterแกแ แ แแแต แ แญแแต แแแแถแฝ แแ แแ แฅแแฝแแแแก
I.Interactive mode แฅแ
II.Script mode
In Interactive mode, Interpreterแก แฅแ python statements keyboard แแญ แฅแตแจแแแ แ แญแ แฅแแแข แ แแต แแ แ แแต valid แจแแ statement แจแแแ execute แซแจแแ waits for another statement.
In Script mode, Interpreterแก python statements แจแซแ file แแตแฅ แซแแตแ contents แ แแต แ แ แแต แซแแฃแธแแแข
แญแ file แฐแแ python program แแญแ python script แญแฃแแแข Interpreterแก each statement แฃแแ แ แแฅแญ execute แซแจแแธแแแข
Interactive Mode
Python interpreter แจแแ operating system แแตแฅ แจแซแแ แ แแ แแฐ command-line แ แแแต Interpreterแกแ แ Interactive mode แแจแ แฅแแฝแแแแข with the following command:
python
When the Python interpreter starts in interactive mode, แฅแแฐแแ แ แญแแต แแแญ displayed แญแแแแข
Python 3.11.8 (main, Feb 11 2024, 13:05:24) [Clang 17.0.2 (https://android.googlesource.com/toolchain/llvm-project d9f89f4d1 on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
แญแ แแ๐ แแแญแต แจแแซแณแจแ Interpreterแก แจแแ แแแญ แฅแแตแตแ แ แฅแจแ แ แ แแแแ แจแแตแ แแตแ python statement execute แแแจแ ready แฅแแฐแแ แแแข๐
>>>
...แญแแฅแแ
@python_pioneers
@python_pioneers
๐3๐2
INTERACTIVE MODE
One of the simplest statements that you can write in Python is a print statement, print แจแแแแแแ แแแแญแต screen แแญ display แแแตแจแ แจแแ แ แ statement แแแข
แแแณแแก แจแแ แ แณแฝ แซแแ statement Hello, Ethiopia! แจแแ แแแแญแต displayed แฅแแฒแแ แซแฐแญแแแข
Notice that แจprint statement แ แแ แแแแญแณแฝแแ แจแแแแ แ quote marks แแญแ แ แตแแ แญแฐ แฅแ แต แแซแจแ แแแฃ qoute marks แ แตแแแ แขแแแ they will not be displayed, these qoutes แ แจแแแแแ แแแแญแต แแแแชแซแ แแจแจแป แซแณแซแแข
แแแแญแฑ displayed แจแฐแฐแจแ แ แแ >>> prompt แฐแแแถ แญแแฃแแฃ แแ statement แฅแแตแตแ แ แฅแจแ แ แ แแ แแแต แแแข
แตแ Python แแแแญ Interactive mode preferable แแแข That means we don't need to create a file, write a code in it, save it....bla bla.... We just write statements and get quick executions.
แจPython interpreter แแแแฃแต แฐแแ แฅแแแ แ แ แแซแฎแฝ แแ แแ แฅแแฝแแแ exit() [ENTER], CTRL + Z for windows, CTRL + D for Mac, Linux or UNIX computers.
แ แแฃแญ python programs แ script mode แฅแแดแต แฅแแฐแแฐแแแ แ แฅแแซแแแข
Stay Tuned!
@python_pioneers
@python_pioneers
One of the simplest statements that you can write in Python is a print statement, print แจแแแแแแ แแแแญแต screen แแญ display แแแตแจแ แจแแ แ แ statement แแแข
แแแณแแก แจแแ แ แณแฝ แซแแ statement Hello, Ethiopia! แจแแ แแแแญแต displayed แฅแแฒแแ แซแฐแญแแแข
>>>print('Hello, Ethiopia!')Notice that แจprint statement แ แแ แแแแญแณแฝแแ แจแแแแ แ quote marks แแญแ แ แตแแ แญแฐ แฅแ แต แแซแจแ แแแฃ qoute marks แ แตแแแ แขแแแ they will not be displayed, these qoutes แ แจแแแแแ แแแแญแต แแแแชแซแ แแจแจแป แซแณแซแแข
>>>print('Hello, Ethiopia!'). [ENTER]
Hello, Ethiopia!
>>>แแแแญแฑ displayed แจแฐแฐแจแ แ แแ >>> prompt แฐแแแถ แญแแฃแแฃ แแ statement แฅแแตแตแ แ แฅแจแ แ แ แแ แแแต แแแข
แตแ Python แแแแญ Interactive mode preferable แแแข That means we don't need to create a file, write a code in it, save it....bla bla.... We just write statements and get quick executions.
แจPython interpreter แแแแฃแต แฐแแ แฅแแแ แ แ แแซแฎแฝ แแ แแ แฅแแฝแแแ exit() [ENTER], CTRL + Z for windows, CTRL + D for Mac, Linux or UNIX computers.
แ แแฃแญ python programs แ script mode แฅแแดแต แฅแแฐแแฐแแแ แ แฅแแซแแแข
Stay Tuned!
@python_pioneers
@python_pioneers
๐3
SCRIPT MODE
Interactive mode แจแแแแแ code test แแแตแจแ แ แแ แขแแแ แ แแ mode แแแ แแธแ codes saved แ แญแแแแข They are simply executed and their results displayed on the screen.
Python statements แฅแแฐ program save แแแตแจแแฃ you save those statements in a fileแฃ แจแแ python Interpreter แ script mode แ แแ แแ แจแแแแแ code execute แแตแจแ แฅแแฝแแแแข
For example, suppose you want to write a Python program that displays the following three lines of text:
My name is Abebe.
I am 25 years old.
I am a university student.
Programแกแ แแแแแแ แ แญแแต text editor แแแ แฅแแฝแแแแฃ แ แแ แตแแจแญแต แฐแแ programแกแ แจแแแแ แตแ file with the .py extension save แฅแแจแแแแแข
แแแณแ fileแกแ แ แแ แตแ save แ แญแแแ แฅแแ แ: ethio.py
แจแแแแแ program run แแแตแจแ แฐแแ แแฐ operating systemแก command-line แ แแแต fileแก แซแแ แต folder แแตแฅ แฅแแฐแแจแฐแแ แฅแแ แแแแก
This starts the Python interpreter in script mode and causes it to execute the statements in the file ethio.py. When the program finishes executing, the Python interpreter exits.
And here is the output:
...แฅแแแฅแแแโก
@python_pioneers
Interactive mode แจแแแแแ code test แแแตแจแ แ แแ แขแแแ แ แแ mode แแแ แแธแ codes saved แ แญแแแแข They are simply executed and their results displayed on the screen.
Python statements แฅแแฐ program save แแแตแจแแฃ you save those statements in a fileแฃ แจแแ python Interpreter แ script mode แ แแ แแ แจแแแแแ code execute แแตแจแ แฅแแฝแแแแข
For example, suppose you want to write a Python program that displays the following three lines of text:
My name is Abebe.
I am 25 years old.
I am a university student.
Programแกแ แแแแแแ แ แญแแต text editor แแแ แฅแแฝแแแแฃ แ แแ แตแแจแญแต แฐแแ programแกแ แจแแแแ แตแ file with the .py extension save แฅแแจแแแแแข
print('My name is Abebe.')
print('I am 25 years old.')
print('I am a university student.')แแแณแ fileแกแ แ แแ แตแ save แ แญแแแ แฅแแ แ: ethio.py
แจแแแแแ program run แแแตแจแ แฐแแ แแฐ operating systemแก command-line แ แแแต fileแก แซแแ แต folder แแตแฅ แฅแแฐแแจแฐแแ แฅแแ แแแแก
python ethio.py
This starts the Python interpreter in script mode and causes it to execute the statements in the file ethio.py. When the program finishes executing, the Python interpreter exits.
And here is the output:
My name is Abebe.
I am 25 years old.
I am a university student.
...แฅแแแฅแแแโก
@python_pioneers
๐1
DATA TYPES IN PYTHON
In Python, data types แจแฐแแซแฉ แจแแจแ แ แญแแถแฝแ categorize แฅแแตแแจแ แญแจแฑแแแก such as numbers, strings, lists, tuples, and dictionaries.
แฅแแ แตแ data types แซแแ understanding for efficient data manipulation แฅแ memory allocation แ แตแแแ แแแข
Here are some common data types in Python:
1. Integer(int):
แญแ data type represent แจแแซแจแแ decimal point แจแแแธแแ แแฅแฎแฝ แแแข
แแแณแ : 5, -10, 100
2. Floating-point(float):
แญแ data type แฐแแ represent แจแแซแจแแ แแฅแฅ(decimal point) แซแแธแแ แแฅแฎแฝ แแแข
แแแณแ : 3.14, -2.5, 100.0
3. String(str):
Represent แจแแซแจแแ แ quotation marks(single, double or triple) enclosed แจแแ textแฆแฝแ แแแข
แแแณแ : 'Python', "Pioneers", '''Ethiopia'''
4. Boolean(bool):
Represents one of two values, True(1) or False(0).
แแแณแ: True, False
5. List:
Represents a collection of elements that can be of different data types. แ square bracket แแ แจแแธแแแ, being itself a data type แแแฝแแ แ แญแแต data types แ แแตแก แญแญแแแข
แแแณแ : [1, 'pioneers', True]
6. Tuple:
แจlist แแญ แฐแแณแณแญ แขแแแ it is immutable (แแแตแ we can not change its contents). แ bracket แญแธแแแแข
แแแณแ: (1, 'name', False)
7. Dictionary:
แ key-value แแแแต แจแฐแซแซแ data types represent แซแจแแแฃ one pointing the other. It is enclosed with curly brackets.
แแแณแ: {'name': 'Abebe', 'age': 30}
แจแ แแตแ variable(we will learn about them) data type แแแแ 'type()' แจแแฃแ built-in function(It is a type of function which is already present in the interpreter as a part of the standard library) แฅแแ แแแแแข
แแแณแ:
TRY IT!
Understanding and manipulating different data types in Python is crucial for writing effective and efficient code.
It also helps in ensuring the correct interpretation and handling of data throughout a program.
แตแ แฅแซแแณแแฑ data type แ แแฃแญ แฅแแแซแแ
@python_pioneers
@python_pioneers
In Python, data types แจแฐแแซแฉ แจแแจแ แ แญแแถแฝแ categorize แฅแแตแแจแ แญแจแฑแแแก such as numbers, strings, lists, tuples, and dictionaries.
แฅแแ แตแ data types แซแแ understanding for efficient data manipulation แฅแ memory allocation แ แตแแแ แแแข
Here are some common data types in Python:
1. Integer(int):
แญแ data type represent แจแแซแจแแ decimal point แจแแแธแแ แแฅแฎแฝ แแแข
แแแณแ : 5, -10, 100
2. Floating-point(float):
แญแ data type แฐแแ represent แจแแซแจแแ แแฅแฅ(decimal point) แซแแธแแ แแฅแฎแฝ แแแข
แแแณแ : 3.14, -2.5, 100.0
3. String(str):
Represent แจแแซแจแแ แ quotation marks(single, double or triple) enclosed แจแแ textแฆแฝแ แแแข
แแแณแ : 'Python', "Pioneers", '''Ethiopia'''
4. Boolean(bool):
Represents one of two values, True(1) or False(0).
แแแณแ: True, False
5. List:
Represents a collection of elements that can be of different data types. แ square bracket แแ แจแแธแแแ, being itself a data type แแแฝแแ แ แญแแต data types แ แแตแก แญแญแแแข
แแแณแ : [1, 'pioneers', True]
6. Tuple:
แจlist แแญ แฐแแณแณแญ แขแแแ it is immutable (แแแตแ we can not change its contents). แ bracket แญแธแแแแข
แแแณแ: (1, 'name', False)
7. Dictionary:
แ key-value แแแแต แจแฐแซแซแ data types represent แซแจแแแฃ one pointing the other. It is enclosed with curly brackets.
แแแณแ: {'name': 'Abebe', 'age': 30}
แจแ แแตแ variable(we will learn about them) data type แแแแ 'type()' แจแแฃแ built-in function(It is a type of function which is already present in the interpreter as a part of the standard library) แฅแแ แแแแแข
แแแณแ:
x = 10
print(type(x)) # Output: <class 'int'>
TRY IT!
Understanding and manipulating different data types in Python is crucial for writing effective and efficient code.
It also helps in ensuring the correct interpretation and handling of data throughout a program.
แตแ แฅแซแแณแแฑ data type แ แแฃแญ แฅแแแซแแ
@python_pioneers
@python_pioneers
๐2
แฅแตแช แญแ
แฝแ แณแซแญ แ แแฅแงแต
Three Feet From Gold:
During the gold rush, a man who had been mining in Colorado for several months quit his job, as he hadnโt struck gold yet and the work was becoming tiresome.
He sold his equipment to another man who resumed mining where it had been left off. The new miner was advised by his engineer that there was gold only three feet away from where the first miner stopped digging.
The engineer was right, which means the first miner was a mere three feet away from striking gold before he quit.
The Moral:
When things start to get hard, try to persevere through the adversity. Many people give up on following their dreams because the work becomes too difficult, tedious, or tiresomeโbut often, youโre closer to the finish line than you may think, and if you push just a little harder, you will succeed.
แแแซแ แแฝแต!โฅ๏ธ
#English_Stories
@python_pioneers
Three Feet From Gold:
During the gold rush, a man who had been mining in Colorado for several months quit his job, as he hadnโt struck gold yet and the work was becoming tiresome.
He sold his equipment to another man who resumed mining where it had been left off. The new miner was advised by his engineer that there was gold only three feet away from where the first miner stopped digging.
The engineer was right, which means the first miner was a mere three feet away from striking gold before he quit.
The Moral:
When things start to get hard, try to persevere through the adversity. Many people give up on following their dreams because the work becomes too difficult, tedious, or tiresomeโbut often, youโre closer to the finish line than you may think, and if you push just a little harder, you will succeed.
แแแซแ แแฝแต!โฅ๏ธ
#English_Stories
@python_pioneers
๐6
VARIABLES IN PYTHON
แ แแฃแญ แ Python แตแ variables แแแแต แฅแแแซแแแข
Stay Tuned!
@python_pioneers
@python_pioneers
แ แแฃแญ แ Python แตแ variables แแแแต แฅแแแซแแแข
Stay Tuned!
@python_pioneers
@python_pioneers
๐3
VARIABLES IN PYTHON
In Python, Variables data values store แแแจแ แแ แจแแซแแแแตแข แ Mathematics แซแจแ a variable is a symbol that represents a numberแก แ แฅแแแแ แแ แฐแแ แแฐแ แแแข แ แฐแแณแณแญแก variable แ python แแแ data value แแ แชแซ แแแก it can be a single letter or a word.
1. Variable Declaration: You declare variables in Python simply by assigning a value to them using the
It is like แจแแ แณแฅแ แ แแฝแ แฅแแ แแฃ แจแ แตแ แตแฐแกแณแแฝแแฃ แฅแแ แจแแแแฝแแตแ แแแญ แณแฅแ แแตแฅ แแจแ แตแฝแแแฝแ so think the same way about variables.
2. Variable Naming Rules:
-แจvariable แฅแ แแฐแแฃ แแฅแญ แฅแ underscore(_) แแซแ แญแฝแแแข
- แจvariable แฅแ แ แแฅแญ แแแแญ แ แญแปแแแข
- Variable names case-sensitive แแธแแข แแแตแ แแแณแ age แฅแ Age แ แแต แ แญแแต variable แ แญแฐแแแข
3. Data Types: Python is dynamically typed, แแแตแ แจvariableแกแ data type declare แแจแ แ แญแ แ แ แฅแแแข Python automatically แจแแแฃแแ data แ แแจแต แจvariableแกแ data type assign แซแจแแแฃ แญแ แแ แแแแ programming languages แจแแฐแซ แ แญแฐแแแข
แแแณแแก difference in variable declaration between Java and Python แฅแแญแก
Declaring a variable in Java
แ แแ แแ variable declare แตแแจแ data typeแกแแ assign แแจแ แญแแญแฅแแแข แแ we don't need to do this in python, since it automatically assigns the type of data at the instant we give it a value.
Declaring a variable in Python:
Let's assign different data types to a variable in python
4. Variable Reassignment: You can reassign a variable to a different value. แฐแแณแณแญ variable แ แแ แ แ value reassign แแจแ แฅแแฝแแแแฃ that means we can give it another value.
...แญแแฅแแ
Practice by assigning different values for variables.
โDon't forget to invite your friendsโ
@python_pioneers
@python_pioneers
In Python, Variables data values store แแแจแ แแ แจแแซแแแแตแข แ Mathematics แซแจแ a variable is a symbol that represents a numberแก แ แฅแแแแ แแ แฐแแ แแฐแ แแแข แ แฐแแณแณแญแก variable แ python แแแ data value แแ แชแซ แแแก it can be a single letter or a word.
1. Variable Declaration: You declare variables in Python simply by assigning a value to them using the
= sign. Variable declare แตแแจแ แ computerแก memory แแตแฅ แจแแแแแแแ value store แจแแแจแแ แต space แญแแ แซแแข It is like แจแแ แณแฅแ แ แแฝแ แฅแแ แแฃ แจแ แตแ แตแฐแกแณแแฝแแฃ แฅแแ แจแแแแฝแแตแ แแแญ แณแฅแ แแตแฅ แแจแ แตแฝแแแฝแ so think the same way about variables.
x = 5
2. Variable Naming Rules:
-แจvariable แฅแ แแฐแแฃ แแฅแญ แฅแ underscore(_) แแซแ แญแฝแแแข
- แจvariable แฅแ แ แแฅแญ แแแแญ แ แญแปแแแข
- Variable names case-sensitive แแธแแข แแแตแ แแแณแ age แฅแ Age แ แแต แ แญแแต variable แ แญแฐแแแข
my_variable = "Hello"
3. Data Types: Python is dynamically typed, แแแตแ แจvariableแกแ data type declare แแจแ แ แญแ แ แ แฅแแแข Python automatically แจแแแฃแแ data แ แแจแต แจvariableแกแ data type assign แซแจแแแฃ แญแ แแ แแแแ programming languages แจแแฐแซ แ แญแฐแแแข
แแแณแแก difference in variable declaration between Java and Python แฅแแญแก
Declaring a variable in Java
int x = 5;
แ แแ แแ variable declare แตแแจแ data typeแกแแ assign แแจแ แญแแญแฅแแแข แแ we don't need to do this in python, since it automatically assigns the type of data at the instant we give it a value.
Declaring a variable in Python:
x = 5
Let's assign different data types to a variable in python
x = 5 # x is an integer
y = 3.14 # y is a float
z = "Hello" # z is a string
4. Variable Reassignment: You can reassign a variable to a different value. แฐแแณแณแญ variable แ แแ แ แ value reassign แแจแ แฅแแฝแแแแฃ that means we can give it another value.
x = 5
x = 10 # x is now assigned the value 10
# x is no more 5
...แญแแฅแแ
Practice by assigning different values for variables.
โDon't forget to invite your friendsโ
@python_pioneers
@python_pioneers
๐5๐2
Multiple-choice questions pertaining to variable usage in Python.
โTest your knowledge about variables with the following questions โ
โTest your knowledge about variables with the following questions โ
1. What is a variable in Python?
Anonymous Quiz
7%
a) A constant value
7%
b) A reserved keyword
77%
c) A name that refers to a value
9%
d) A function
2. Which of the following variable names is invalid in Python?
Anonymous Quiz
16%
a) my_variable
63%
b) 2nd_variable
11%
c) variable2
11%
d) _variable
3. What is the correct way to assign a value of 5 to a variable named "x" in Python?
Anonymous Quiz
87%
a) x = 5
3%
b) 5 = x
10%
c) x == 5
0%
d) x := 5
4. What happens if you try to access a variable that has not been defined in Python?
Anonymous Quiz
30%
a) It raises a SyntaxError
15%
b) It creates a new variable with that name
38%
c) It raises a NameError
17%
d) It returns None
๐2
5. In Python, is it possible to assign multiple variables in a single line?
Anonymous Quiz
74%
a) Yes, using comma-separated values
11%
b) No, Python does not support multiple variable assignment
10%
c) Yes, but only for integers
4%
d) Yes, but only for strings
๐2
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:
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:
...แญแแฅแแ
@python_pioneers
@python_pioneers
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:
4. Assignment Operations:
แฅแแแ แฐแแ แ แแตแ value แvariable assign แแแตแจแ แแ แจแแแ แแแแข
+= : แ แแ แ แฉแ แซแแแ operand แ แแซ แ แฉแ แฃแแ operand แแญ แญแฐแแญแ แแคแฑแ แ แแซ แ แฉแ แแแ operand assign แซแจแแแแข
-= : แ แแ แ แฉแ แซแแแ operand แจแแซแ แ แแแแต แแคแฑแ แ แแซ แ แฉแ แแแ operand assign แซแจแแแข
*= : แ แแซ แ แฉแ แซแแแ operand แ แแ แ แฉแ แฃแแ แซแฃแแ แแคแฑแ แ แแซ แ แฉแ แแแ operand assign แซแจแแแข
/= : แ แแซ แ แฉแ แซแแแ operand แ แแ แ แฉแ แฃแแ operand แซแซแแแ แแคแฑแ แ แแซ แ แฉแ แแแ operand assign แซแจแแแแข
Code Example:
These are just some of the basic operations in python, we believe you have grasped some knowledge about them.
@python_pioneers
@python_pioneers
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
๐3โค1
GROW THROUGH WHAT YOU GO THROUGH.
แจแแซแแฅแแ แแแแแ แแฐแ แฅแ แแฐแแญแ แแแแญแฃ แแแฐแ แฅแ แแแ แแจแญ แฅแตแ แญแฐแ แแแข แ แแซแแฅแแ แฝแแฎแฝ แจแแแจแญ แแญแ แจแแแฐแต แญแแ แself development แฅแ แฅแซแณแฝแแ แแแปแปแ แฅแแฐ แฅแตแ แ แตแญแแ แแแ แ แ แแฅแแข
แแแซแ แแฝแต!
@python_pioneers
แจแแซแแฅแแ แแแแแ แแฐแ แฅแ แแฐแแญแ แแแแญแฃ แแแฐแ แฅแ แแแ แแจแญ แฅแตแ แญแฐแ แแแข แ แแซแแฅแแ แฝแแฎแฝ แจแแแจแญ แแญแ แจแแแฐแต แญแแ แself development แฅแ แฅแซแณแฝแแ แแแปแปแ แฅแแฐ แฅแตแ แ แตแญแแ แแแ แ แ แแฅแแข
แแแซแ แแฝแต!
@python_pioneers
๐5๐ฅฐ2