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
ChatGPT was asked to generate memes that only AI would understand.

If you smiled - think about it. ๐Ÿค–

#AI

@python_pioneers
๐Ÿ˜2
แ‰ แ‹šแˆ…แ‰ฝ แŠ แŒญแˆญ story แ‹ฐแŒแˆž แˆแˆฝแ‰ณแ‰ฝแˆแŠ• แ‰ฅแˆฉแˆ… แŠ แˆญแŒ‰๐ŸŒŒ

The Travelers and The Plane Tree

Two men were walking along one summer day. Soon it became too hot to go any further and, seeing a large plane tree nearby, they threw themselves on the ground to rest in its shade. Gazing up into the branches one man said to the other,

"What a useless tree this is. It does not have fruit or nuts that we can eat and we cannot even use its wood for anything."

"Don't be so ungrateful," rustled the tree in reply. "I am being extremely useful to you at this very moment, shielding you from the hot sun. And you call me a good-for-nothing!"

Moral: All of God's creations have a good purpose. We should never belittle God's blessings.

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

#Story

@python_pioneers
โค6๐Ÿ‘3๐Ÿ™1
๐Ÿ“ฑ PyDroid: Your Python Playground on Android!
แˆˆAndroid แ‰ฐแŒ แ‰ƒแˆšแ‹Žแ‰ฝ python codes run แˆˆแˆ›แˆจแŒ แˆŒแˆ‹แŠ›แ‹ แŠ แˆ›แˆซแŒญ แАแ‹แข

๐Ÿ”— Download the app from Play Store: https://play.google.com/store/apps/details?id=ru.iiec.pydroid3

With PyDroid, you can write, test, and debug Python code with ease, whether you're a beginner or an experienced developer.

Or for arm64 structure you can download the apk file we uploaded below ๐Ÿ‘‡

@python_pioneers
๐Ÿ‘1
Being youthful is not just about age, but about being useful in every moment.

แ‹ˆแŒฃแ‰ตแАแ‰ต แˆ€แ‰ฅแ‰ต แАแ‹แฃ แŠฅแŒแ‹šแŠ แ‰ฅแˆ”แˆญ แˆฒแˆแŒฅแˆจแŠ• แ‹ญแˆ„แŠ•แŠ• แˆ€แ‰ฅแ‰ต แ‰ แŠฅแ‹ซแŠ•แ‹ณแŠ•แ‹ณแ‰ฝแŠ• แ‹แˆตแŒฅ แŠ แˆตแ‰€แˆแŒงแˆแข แ‹ญแˆ„ แˆ€แ‰ฅแ‰ต แ‹ฐแŒแˆž แ‰ แŠ แˆ‰แ‰ณแ‹Š แАแŒˆแˆฎแ‰ฝ แˆ˜แ‰ฃแŠจแŠ• แ‹จแˆˆแ‰ แ‰ตแˆแฃ แŠ แˆซแ‹ณแАแ‰ต แˆ˜แˆตแˆŽแŠ• แ‰ แˆ›แ‹ญแˆจแ‰ฃ แАแŒˆแˆญ แˆ‹แ‹ญ แŠ แŠ“แ‹แˆˆแ‹แข แŠฅแ‹ซแŠ•แ‹ณแŠ•แ‹ทแŠ• 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:

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 แŠฅแŠ•แ‹ฒแˆ†แŠ• แ‹ซแ‹ฐแˆญแŒ‹แˆแข

>>>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 แŠฅแŠ“แˆจแŒˆแ‹‹แˆˆแŠ•แข

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) แŠฅแŠ•แŒ แ‰€แˆ›แˆˆแŠ•แข

แˆˆแˆแˆณแˆŒ:

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
๐Ÿ‘6
VARIABLES IN PYTHON

แ‰ แ‰€แŒฃแ‹ญ แ‰ 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 = 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
Forwarded from Luna's pathway๐Ÿค— (Luna)
#Quote of the day
โค3
Multiple-choice questions pertaining to variable usage in Python.

โ“Test your knowledge about variables with the following questions โ“
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