Python Pioneers: A Beginner's Guide ๐Ÿ‡ช๐Ÿ‡น
8.62K 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
แ‰ แ‹ฒแŒ‚แ‰ณแˆ แŠขแ‰ตแ‹ฎแŒตแ‹ซ แŒ‰แ‹ž แŠ แŠ•แ‹ต แŠฅแˆ˜แˆญแ‰ณ แ‹จแ‰ณแ‹จแ‰ แ‰ต แ‹ฐแˆจแŒƒ แˆ‹แ‹ญ แ‹ฐแˆญแˆฐแŠ“แˆแข แŠขแ‰ตแ‹ฎ แ‰ดแˆŒแŠฎแˆ แŠจแ‰ชแ‹› แŠฉแ‰ฃแŠ•แ‹ซ แŒ‹แˆญ แ‰ แˆ˜แ‰ฐแ‰ฃแ‰ แˆญ แ‰ แŠขแ‰ตแ‹ฎแ‹ฝแ‹ซ แ‹จแˆ˜แŒ€แˆ˜แˆชแ‹ซแ‹แŠ• แ‰ แŠชแˆต แ‹จแˆšแ‹ซแ‹ 'แ‰จแˆญแ‰ฑแ‹‹แˆ แ‰ชแ‹›' แŠซแˆญแ‹ต แ‰ฅแˆŽแˆ แ‹จแ‰ฐแˆปแˆปแˆˆ แ‹จแˆ€แ‹‹แˆ‹ แŠ แŒˆแˆแŒแˆŽแ‰ต แ‰ แ‰ชแ‹› แ‹ณแ‹ญแˆฌแŠญแ‰ต แŠฅแŠ“ แ‰ แ‰ดแˆŒแ‰ฅแˆญ แˆจแˆšแ‰ต แŠ แ‰…แˆญแ‰งแˆแข

แ‰ชแ‹› แ‹ณแ‹ญแˆฌแŠญแ‰ต แŠจ190 แˆ€แŒˆแˆซแ‰ต แ‰ แˆ‹แ‹ญ แ‰€แˆˆแˆ แ‹ซแˆˆ แ‹จแŒˆแŠ•แ‹˜แ‰ฅ แˆ›แ‹˜แ‹‹แ‹ˆแˆญ แŠ แŒˆแˆแŒแˆŽแ‰ตแŠ• แ‰ แ‰ดแˆŒแ‰ฅแˆญ แ‰จแˆญแ‰ฑแ‹‹แˆ แŠซแˆญแ‹ต แ‰แŒฅแˆญ แŠ แˆ›แŠซแŠแАแ‰ต แ‹จแˆšแ‹ซแ‰€แˆ‹แŒฅแ แ‹ญแˆ†แŠ“แˆแข แ‹ญแˆ… แŠ แ‹ฒแˆต แŠ แŒˆแˆแŒแˆŽแ‰ต แŠจ47.55 แˆšแˆŠแ‹ฎแŠ• แ‰ แˆ‹แ‹ญ แ‹จแˆ†แŠ‘ แ‹จแ‰ดแˆŒแ‰ฅแˆญ แ‰ฐแŒ แ‰ƒแˆšแ‹Žแ‰ฝแŠ• แ‹ซแŒˆแˆˆแŒแˆ‹แˆแข แŠขแ‰ตแ‹ฎ แ‰ดแˆŒแŠฎแˆ แ‰ตแˆแ‰… แˆตแˆซ แˆฐแˆญแ‰ทแˆแข

A significant milestone in our Digital Ethiopia journey has been achieved with Ethio telecom, in partnership with Visa Inc., launching the country's first wallet-based Virtual Visa Card and enhanced remittance services via Visa Direct and telebirr Remit.

Visa Direct facilitates easy money transfers to Ethiopia from over 190 countries using a telebirr virtual card number. This partnership supports over 47.55 million telebirr users and advances Ethiopia's digital financial services. Well done to EthioTelecom!
๐Ÿ‘1
Let's have some fun๐Ÿ˜Š
๐Ÿคฃ4
What are Tuples?

Tuple แ‰ python แ‹จobjects แˆตแ‰ฅแˆตแ‰ฅ แˆฒแˆ†แŠ• แ‰ฃแˆˆแˆแ‹ แŠฅแŠ•แ‹ฐแ‰ฐแˆ›แˆญแАแ‹ we can't change the order of the items in it.


ObjectแŠฆแ‰น strings, lists, tuples, integers etc. แˆŠแˆ†แŠ‘ แ‹ญแ‰ฝแˆ‹แˆ‰แข

แ‹จTuple insertion characteristics preserved แАแ‹แฃ once elements แŠซแˆตแ‰€แˆ˜แŒฅแŠ• we can't modify them.

Elements แŠจtuple แ‹จแˆแŠ“แŒˆแŠ˜แ‹ แˆ˜แŒ€แˆ˜แˆชแ‹ซ แ‰ฃแˆตแ‰€แˆ˜แŒฅแŠ•แ‰ แ‰ต order แАแ‹แข

Immutable: Once if we create a tuple object, then we cannot modify the content of the tuple object.

แŠจlist แ‹จแˆšแˆˆแ‹ซแ‰ธแ‹ แАแŒˆแˆญ แ‰ขแŠ–แˆญ แ‹ญแˆ… แАแ‹ แก immutable แˆ˜แˆ†แŠ“แ‰ธแ‹แข


Tuple duplicate data store แˆ›แˆจแŒ แ‹ญแ‰ฝแˆ‹แˆ unlike set.

Tuple แ‰ฐแˆ˜แˆณแˆณแ‹ญแˆ แˆ†แА แ‹จแ‰ฐแˆˆแ‹ซแ‹จ data type store แ‹ซแˆจแŒ‹แˆ‰ แŠฅแŠ•แ‹ฐ list แˆ›แˆˆแ‰ต แАแ‹

to be cont'd...

#Tuple

@python_pioneers
๐Ÿ‘4
Difference between Tuple and List

@python_pioneers
๐Ÿ‘3
แ‹ฐแˆ…แŠ“ แ‹‹แˆ‹แ‰ฝแˆ แ‰คแ‰ฐแˆฐแ‰ฆแ‰ฝ!

แ‹›แˆฌ แ‰ฝแŒแŠ แ‰ฐแŠจแˆ‹แ‰ฝแˆ แ‹ˆแ‹ญ?
Anonymous Poll
14%
แŠ แ‹Ž
86%
แŠ แ‹ญ
Tuple แ‹จแˆแŠ•แˆแŒฅแˆญแ‰ฃแ‰ธแ‹ แ‰ฅแ‹™ แˆ˜แŠ•แŒˆแ‹ถแ‰ฝ แŠ แˆ‰ แฃ like

1. By using tuple() function
2. By manually inserting the elements inside a parenthesis

แˆˆแˆแˆณแˆŒ :
my_tuple = ("Monday", "Tuesday" "Wednesday")

แ‹ˆแ‹ญแˆ range function inside tuple function แ‰ แˆ˜แŒ แ‰€แˆ a tuple of numbers แˆ˜แแŒ แˆญ แŠฅแŠ•แ‰ฝแˆ‹แˆˆแŠ•แข

แ‹จTuple แŒฅแ‰…แˆžแ‰ฝ แ‹แˆตแŒฅ packing แŠฅแŠ“ unpacking แ‰ตแˆแ‰แŠ• แ‹ตแˆญแˆป แ‹ญแ‹ˆแˆตแ‹ณแˆ‰แข

Packing

We can create a tuple by packing a group of variables.

Syntax :
tuple_name = elements

แˆˆแˆแˆณแˆŒ :
a, b, c, d = 10, 20, 30, 40
my_tuple = a, b, c, d
print(my_tuple)

#Output: (10, 20, 30, 40)

Unpacking

Tuple unpacking is the reverse process of tuple packing, we can unpack a tuple and assign its values to different variables.

Syntax :
elements = tuple_name

แˆˆแˆแˆณแˆŒ :
my_tuple = (10, 20, 30, 40)
a, b, c, d = my_tuple

print(" a =", a, " b =", b, " c =", c, " d =", d)

#Output : a = 10 b = 20 c = 30 d = 40

Tuple unpacking แ‰ แˆ˜แŒ แ‰€แˆ multiple variables แ‰ แŠ แŠ•แ‹ต แŒŠแ‹œ declare แˆ›แ‹ตแˆจแŒ แŠฅแŠ•แ‰ฝแˆ‹แˆˆแŠ•แข


#Tuple

@python_pioneers
Tomorrow, we will be building a simple Python number guessing game to ensure you gain deep and applicable knowledge from what you're learning.

#NumberGuessingGame

@python_pioneers
Media is too big
VIEW IN TELEGRAM
แ‰ตแˆ‹แŠ•แ‰ต แ‰ฃแˆแАแ‹ แˆ˜แˆ แˆจแ‰ต here is our simple number guessing game python code.

แˆตแˆˆ codeแŠก แŠ แˆฐแˆซแˆญ แŠจแˆตแˆญ แŠฅแŠ•แŒฝแ‹แˆˆแŠ•...

#Game
#GuessGame

@python_pioneers
๐Ÿ‘1
Number guessing game แ‰ Python แ‹ญแˆ„แŠ• แ‹ญแˆ˜แˆตแˆ‹แˆแฃ แŠฅแ‹ซแŠ•แ‹ณแŠ•แ‹ฑแŠ• แ‹จcodeแŠกแŠ• section แŠฅแˆตแ‰ฒ แŠฅแŠ•แ‹ญแฃ

1. Importing the random module:


   import random

- `random moduleแŠ• import แ‹ซแˆจแŒแАแ‹ set แ‰ฃแˆจแŒแАแ‹ range แŒˆแ‹ฐแ‰ฅ random แ‰แŒฅแˆญ แŠฅแŠ•แ‹ฒแˆฐแŒ แŠ• แАแ‹แข

2. User Input for the Range:

   min = int(input("Minimum number for your guess range: "))
max = int(input("Maximum number for your guess range: "))

GameแŠกแŠ• แ‹จแˆšแŒซแ‹ˆแ‰ฑแ‹ แˆฐแ‹ แˆˆguessing range minimum แŠฅแŠ“ maximum value แŠฅแŠ•แ‹ฒแˆ˜แˆญแŒฅ แŠฅแŠ•แŒ แ‹ญแ‰€แ‹‹แˆˆแŠ•แข แŠจแ‹› แ‹จแ‰ฐแ‰€แ‰ แˆแАแ‹แŠ• string data type int() function แ‰ แˆ˜แŒ แ‰€แˆ แ‹ˆแ‹ฐ integerแАแ‰ต แŠฅแŠ•แ‰€แ‹ญแˆจแ‹‹แˆˆแŠ•แข


3. Generating a Random Number:

   rand_num = random.randint(min, max)

แ‰ แ‹šแˆ… section แ‹ฐแŒแˆž random number generate แŠฅแŠ•แ‹ฒแ‹ซแˆจแŒแˆแŠ• import แ‹ซแˆจแŒแАแ‹แŠ• module แ‰ฐแŒ แ‰…แˆ˜แŠ“แˆ:
Using random.randint()

4. Initializing the Guess Counter:

   no_of_guesses = 0

แŠฅแ‹šแˆ… แ‹ฐแŒแˆž userแŠก แˆแŠ• แ‹ซแˆ…แˆ แŒŠแ‹˜ แŠฅแŠ•แ‹ฐแŒˆแˆ˜แ‰ฐ แ‹จแˆแŠ•แ‰†แŒฃแŒ แˆญแ‰ แ‰ตแŠ• variable declare แŠ แˆญแŒˆแŠ“แˆแฃ initial value แ‹ฐแŒแˆž zero แˆฐแŒฅแ‰ฐแŠ•แ‹‹แˆแข

#GuessGame

@python_pioneers
while True:
user_guess = int(input("Make a guess: "))
if user_guess == rand_num:
print("Congrats, you got the number!")
break
elif user_guess > max or user_guess < min:
print("Your guess is out of range!")
break
elif user_guess > rand_num:
print("You are above the number, make a lower guess.")
elif user_guess < rand_num:
print("You are below the number, make a higher guess.")
else:
print("Wrong Input!")
break
no_of_guesses += 1

- The program enters an infinite loop using while True: where the user is repeatedly prompted to guess the number.

- Checking if the Guess is Correct:
UserแŠก แ‹ซแˆตแŒˆแ‰ฃแ‹ แ‰แŒฅแˆญ แŠจ random numberแŠก แŒ‹แˆญ แŠฅแŠฉแˆ แŠจแˆ†แА "Congrats, ..." แ‹จแˆšแˆˆแ‹ message printed แ‹ญแˆ†แŠ“แˆแข

- Checking for Out-of-Range Guesses:
UserแŠก แ‹ซแˆตแŒˆแ‰ฃแ‹ แ‰แŒฅแˆญ specified แŠจแˆ†แАแ‹ range แ‹แŒช แŠจแˆ†แА loopแŠก แ‹ญแ‰†แˆ›แˆแข


- Providing Hints:

- If the guess is higher than the random number, the user is informed and asked to guess a lower number.

- If the guess is lower than the random number, the user is informed and asked to guess a higher number.



- Incrementing the Guess Counter:

After each guess, the no_of_guesses counter is incremented by 1 to track the number of attempts.

#GuessGame

@python_pioneers
๐Ÿ‘3โšก1๐Ÿ™1
This media is not supported in your browser
VIEW IN TELEGRAM
๐Ÿ˜๐Ÿ˜๐Ÿ˜๐Ÿ˜๐Ÿ˜๐Ÿ˜๐Ÿ˜๐Ÿ˜๐Ÿ˜๐Ÿ˜
๐Ÿ˜5๐Ÿ‘1