Tuple แจแแแแฅแญแฃแธแ แฅแ แแแแถแฝ แ แ แฃ like
1. By using tuple() function
2. By manually inserting the elements inside a parenthesis
แแแณแ :
แแญแ range function inside tuple function แ แแ แแ a tuple of numbers แแแ แญ แฅแแฝแแแแข
แจTuple แฅแ แแฝ แแตแฅ packing แฅแ unpacking แตแแแ แตแญแป แญแแตแณแแข
Packing
We can create a tuple by packing a group of variables.
แแแณแ :
Unpacking
Tuple unpacking is the reverse process of tuple packing, we can unpack a tuple and assign its values to different variables.
แแแณแ :
Tuple unpacking แ แแ แแ multiple variables แ แ แแต แแ declare แแตแจแ แฅแแฝแแแแข
#Tuple
@python_pioneers
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
#NumberGuessingGame
@python_pioneers
Media is too big
VIEW IN TELEGRAM
แตแแแต แฃแแแ แแ แจแต here is our simple number guessing game python code.
แตแ codeแก แ แฐแซแญ แจแตแญ แฅแแฝแแแ...
#Game
#GuessGame
@python_pioneers
แตแ codeแก แ แฐแซแญ แจแตแญ แฅแแฝแแแ...
#Game
#GuessGame
@python_pioneers
๐1
Number guessing game แ Python แญแแ แญแแตแแแฃ แฅแซแแณแแฑแ แจcodeแกแ section แฅแตแฒ แฅแแญแฃ
1. Importing the
- `random
Gameแกแ แจแแซแแฑแ แฐแ แguessing range minimum แฅแ maximum value แฅแแฒแแญแฅ แฅแแ แญแแแแแข แจแ แจแฐแแ แแแแ string data type int() function แ แแ แแ แแฐ integerแแต แฅแแแญแจแแแแข
3. Generating a Random Number:
แ แแ section แฐแแ random number generate แฅแแฒแซแจแแแ import แซแจแแแแ module แฐแ แ แแแ:
Using
4. Initializing the Guess Counter:
แฅแแ แฐแแ userแก แแ แซแ แ แแ แฅแแฐแแแฐ แจแแแแฃแ แญแ แตแ variable declare แ แญแแแแฃ initial value แฐแแ zero แฐแฅแฐแแแแข
#GuessGame
@python_pioneers
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
The Weight of the Glass
Once upon a time a psychology professor walked around on a stage while teaching stress management principles to an auditorium filled with students. As she raised a glass of water, everyone expected theyโd be asked the typical โglass half empty or glass half fullโ question. Instead, with a smile on her face, the professor asked, โHow heavy is this glass of water Iโm holding?โ
Students shouted out answers ranging from eight ounces to a couple pounds.
She replied, โFrom my perspective, the absolute weight of this glass doesnโt matter. It all depends on how long I hold it. If I hold it for a minute or two, itโs fairly light. If I hold it for an hour straight, its weight might make my arm ache a little. If I hold it for a day straight, my arm will likely cramp up and feel completely numb and paralyzed, forcing me to drop the glass to the floor. In each case, the weight of the glass doesnโt change, but the longer I hold it, the heavier it feels to me.โ
As the class shook their heads in agreement, she continued, โYour stresses and worries in life are very much like this glass of water. Think about them for a while and nothing happens. Think about them a bit longer and you begin to ache a little. Think about them all day long, and you will feel completely numb and paralyzed โ incapable of doing anything else until you drop them.โ
#EnglishStory
@python_pioneers
Once upon a time a psychology professor walked around on a stage while teaching stress management principles to an auditorium filled with students. As she raised a glass of water, everyone expected theyโd be asked the typical โglass half empty or glass half fullโ question. Instead, with a smile on her face, the professor asked, โHow heavy is this glass of water Iโm holding?โ
Students shouted out answers ranging from eight ounces to a couple pounds.
She replied, โFrom my perspective, the absolute weight of this glass doesnโt matter. It all depends on how long I hold it. If I hold it for a minute or two, itโs fairly light. If I hold it for an hour straight, its weight might make my arm ache a little. If I hold it for a day straight, my arm will likely cramp up and feel completely numb and paralyzed, forcing me to drop the glass to the floor. In each case, the weight of the glass doesnโt change, but the longer I hold it, the heavier it feels to me.โ
As the class shook their heads in agreement, she continued, โYour stresses and worries in life are very much like this glass of water. Think about them for a while and nothing happens. Think about them a bit longer and you begin to ache a little. Think about them all day long, and you will feel completely numb and paralyzed โ incapable of doing anything else until you drop them.โ
The moral: Itโs important to remember to let go of your stresses and worries. No matter what happens during the day, as early in the evening as you can, put all your burdens down. Donโt carry them through the night and into the next day with you. If you still feel the weight of yesterdayโs stress, itโs a strong sign that itโs time to put the glass down
#EnglishStory
@python_pioneers
โค6๐ฅ2
แจแดแแแซแ แแตแซแฝ แฅแ แแแ แตแซ แ แตแชแซแ
แแจแ แฑแฎแญ แแญแต แคแต แแญแงแแข
แแญแต แคแต แ 5 แแแฎแ แฉแฎ แแญแ 5.56 แแแฎแ แถแแญ แแต แฐแแ แแณแฉแ แฅแแฒแจแณแฐแ แแตแแแณแแข
แจแแจแแณแญ แฅแแณแญแแฃ แแ แณแแทแแข
แฅแแณแ แฐแจแแช แแญแแซ แตแแแฐแจแ แแ แจแฐแฃแแแข
แ แณแแแต แแแต แแ แแแแต แชแแญแต แแตแจแ แฅแแณแแ แต แฐแแแฟแแข
แฑแฎแญ แจแแแต แ แแต แแชแต แ แ แซแขแซ แคแญแแต แฐแญแ แจแณแฐแจ แ แแ แ แแแต แแฅแฅแญ แตแญ แแญแถ แแ แญแข แจแแ แ แแญ แ แ แ แแแจแต แตแแแญแปแ แจแแแซ แแฅแถ แ แแญแต แคแต แแณแฉ แณแญแทแแข
แแญแต แคแฑแ แจแแจแแณแญ แฅแแณแญแแฃ แ แแแต แจ5 แแแฎแ แฉแฎ แแตแตแ แแ แถแแณแแข
แจแแจแแณแญ แแแแตแต แฑแฎแญ แแญ แแญแแซ แจแจแแฐแ แ แดแแแซแ แฆ
- แแฐแฌแต แจแแตแจแ / แแฅแฅแญ แจแแตแจแ แญแแฐแต แ แแฃ
- แแฃแแตแแฃแแต แ แตแแแ แแจแ แ แญแฐแฅแ
- แจแแแแ แตแญแแถแฝ แญแแธแแ แณแแฃ
- แจแ แฐแแ แฅแ แแแแญ แญแจแแแแ แณแ
- แฝแฅแญแฃ แแ แแแแฐแชแแ แญแฐแซแ แณแ แ แแ แแแข
แดแแแซแ แแฐ 1 แขแแฎแ แฐแ แแแแฝ แซแแต แฒแแ แ แแปแแฑแ แฐแ แแแฑ แ แฐแ แ แ แจแแแแญแต แฅแ แแจแ แแแแฅ แ แฅแแแฝ แแแต แฅแ แ แฐแแซแญ แแแข
#TikvahEthiopia
@tikvahethiopia
แแญแต แคแต แ 5 แแแฎแ แฉแฎ แแญแ 5.56 แแแฎแ แถแแญ แแต แฐแแ แแณแฉแ แฅแแฒแจแณแฐแ แแตแแแณแแข
แจแแจแแณแญ แฅแแณแญแแฃ แแ แณแแทแแข
แฅแแณแ แฐแจแแช แแญแแซ แตแแแฐแจแ แแ แจแฐแฃแแแข
แ แณแแแต แแแต แแ แแแแต แชแแญแต แแตแจแ แฅแแณแแ แต แฐแแแฟแแข
แฑแฎแญ แจแแแต แ แแต แแชแต แ แ แซแขแซ แคแญแแต แฐแญแ แจแณแฐแจ แ แแ แ แแแต แแฅแฅแญ แตแญ แแญแถ แแ แญแข แจแแ แ แแญ แ แ แ แแแจแต แตแแแญแปแ แจแแแซ แแฅแถ แ แแญแต แคแต แแณแฉ แณแญแทแแข
แแญแต แคแฑแ แจแแจแแณแญ แฅแแณแญแแฃ แ แแแต แจ5 แแแฎแ แฉแฎ แแตแตแ แแ แถแแณแแข
แจแแจแแณแญ แแแแตแต แฑแฎแญ แแญ แแญแแซ แจแจแแฐแ แ แดแแแซแ แฆ
- แแฐแฌแต แจแแตแจแ / แแฅแฅแญ แจแแตแจแ แญแแฐแต แ แแฃ
- แแฃแแตแแฃแแต แ แตแแแ แแจแ แ แญแฐแฅแ
- แจแแแแ แตแญแแถแฝ แญแแธแแ แณแแฃ
- แจแ แฐแแ แฅแ แแแแญ แญแจแแแแ แณแ
- แฝแฅแญแฃ แแ แแแแฐแชแแ แญแฐแซแ แณแ แ แแ แแแข
แดแแแซแ แแฐ 1 แขแแฎแ แฐแ แแแแฝ แซแแต แฒแแ แ แแปแแฑแ แฐแ แแแฑ แ แฐแ แ แ แจแแแแญแต แฅแ แแจแ แแแแฅ แ แฅแแแฝ แแแต แฅแ แ แฐแแซแญ แแแข
#TikvahEthiopia
@tikvahethiopia
This media is not supported in your browser
VIEW IN TELEGRAM
๐๐๐๐๐๐๐๐๐๐๐
๐3๐คฃ3๐1
Forwarded from Tikvah-University
แ 2016 แ.แ แ แซแต แจแแแแฅแต แฉแแจแญแฒแฒแแฝ 16 แแฎแแซแแปแธแแ แแแ แ แแ แแแ
แ แฅแแฒแซแแ แ แตแฐแญแแแแกแก
แ แฒแต แ แ แฃ แณแญแแตแ แดแญแแแ แฉแแจแญแฒแฒ แแ แแฃ แฃแแญ แณแญ แฉแแจแญแฒแฒ แ แซแตแฃ แ แฒแต แ แ แฃ แฉแแจแญแฒแฒ แแแต แฅแแฒแแ แแจแแซ แฉแแจแญแฒแฒ แ แแต แ แตแแฉ 16 แแฎแแซแแฝ แแแ แ แแ แแแ แ แแแแณแธแแ แฐแฐแแทแแกแก
แญแ แแแ แ แ แแ แ แแ แฐแแฃแญแแต แซแแ แฐแแช แแแแซแต แฅแแฐแแซแแ แ แตแแ แญแต แแแตแดแญ แจแจแแฐแ แตแแ แญแต แแแต แแญแ แ แตแฐแณแฐแญแ แแฐแจแฐ แแแต แแช แตแซ แ แตแแปแ แฐแแแ แ แฅแญแ (แถ/แญ) แแฌ แ แ แฒแต แ แ แฃ แ แฐแแแจแ แแแญ แ แแ แจแตแแ แญแต แแฃแค แแญ แฐแแแจแแแกแก
@tikvahuniversity
แ แฒแต แ แ แฃ แณแญแแตแ แดแญแแแ แฉแแจแญแฒแฒ แแ แแฃ แฃแแญ แณแญ แฉแแจแญแฒแฒ แ แซแตแฃ แ แฒแต แ แ แฃ แฉแแจแญแฒแฒ แแแต แฅแแฒแแ แแจแแซ แฉแแจแญแฒแฒ แ แแต แ แตแแฉ 16 แแฎแแซแแฝ แแแ แ แแ แแแ แ แแแแณแธแแ แฐแฐแแทแแกแก
แญแ แแแ แ แ แแ แ แแ แฐแแฃแญแแต แซแแ แฐแแช แแแแซแต แฅแแฐแแซแแ แ แตแแ แญแต แแแตแดแญ แจแจแแฐแ แตแแ แญแต แแแต แแญแ แ แตแฐแณแฐแญแ แแฐแจแฐ แแแต แแช แตแซ แ แตแแปแ แฐแแแ แ แฅแญแ (แถ/แญ) แแฌ แ แ แฒแต แ แ แฃ แ แฐแแแจแ แแแญ แ แแ แจแตแแ แญแต แแฃแค แแญ แฐแแแจแแแกแก
@tikvahuniversity
แฅแแ แจแฐแจแตแแ แฅแ แแแฎแฝแ แฐแปแแจแ แแแข แซแแฐแแแ แฐแญแแฃ แซแแฐแฐแ แ แฆแญแฃ แซแแฐแฐแจแ แแฅแแตแฃ แซแแฐแคแจ แคแซแฃ แซแแฐแแแจ แแฐแ แ แแแ แจแแข แ แแฃแช แญแณแณ แแแแ แฅแจแฐแปแแญแแ แแแข
-FDRE PM DR. Abiy Ahmed
#Puagume1
#PMDRAbiyAhmed
@AbiyAhmedAliofficial
@python_pioneers
๐ฅด1
Python Pioneers: A Beginner's Guide ๐ช๐น
แฅแแ
แจแฐแจแตแแ แฅแ แแแฎแฝแ แฐแปแแจแ แแแข แซแแฐแแแ แฐแญแแฃ แซแแฐแฐแ แ แฆแญแฃ แซแแฐแฐแจแ แแฅแแตแฃ แซแแฐแคแจ แคแซแฃ แซแแฐแแแจ แแฐแ แ แแแ แจแแข แ แแฃแช แญแณแณ แแแแ แฅแจแฐแปแแญแแ แแแข -FDRE PM DR. Abiy Ahmed #Puagume1 #PMDRAbiyAhmed @AbiyAhmedAliofficial @python_pioneers
๐แ แญ แ แ แแต แแแฒแจแ แแ แ แแแปแฝแแ แ แญ แ แ แขแ แแ แฆแ แแต แแญแฐแ
๐ฅด4๐2
Python Pioneers: A Beginner's Guide ๐ช๐น
๐แ แญ แ แ แแต แแแฒแจแ แแ แ แแแปแฝแแ แ แญ แ แ แขแ แแ แฆแ แแต แแญแฐแ
แ แแ แฅแบ แแแฑแ แตแฐแแฃ แแญแฐแแ แฅแแแญ แถ แแต... แฃ แ แญแปแแ?โบ๏ธ
๐3๐จโ๐ป2๐1
Dictionary in Python
แ Python programming language dictionary แจแแฃแแ แ key-value แฅแแต แแแ แจแแแแก elements แตแฅแตแฅ แแแข Key แจแแแ แแแ แจแซแแแ corresponding value acess แแตแจแ แตแแแแ แแแข
Dictionaries แจแแ แ แแต แตแlists แตแแแญ แฅแแณแจแแ mutable แแธแแฃ แญแ แ แแแต listแก แจแฐแแ แจ แ แแ elementแฆแนแ modify แแจแ แฅแแฝแแแแข
แ python dictionary แแแแ แญ curly braces '{}' แแ แจแแแ แแแ แจแแ key-value pair แ colon ':' แฅแแแซแแแข
แแแณแแก
my_dict = {'key1': 'value1', 'key2': 'value2'}You can access values in a dictionary by referencing the key in square brackets ([]).
แแแณแ :
print(my_dict['key1']) # Output: value1
แแแ แฐแแ แจแฑแแซแฉ methods แฅแ functions แ แแ แแ แจdictionary แ แฒแต elements แแจแแญ แฃ แซแแตแ modify แแจแแฃ delete แแจแ แฅแแฝแแแ
Dictionaries are commonly used in Python for storing data that needs to be looked up quickly using a unique key.
Dictionaries แ Python แแตแฅ key แ แแ แแ แ แแฅแแต แแแแ แซแแฃแธแแ แแจแแแฝ แแแจแแธแต แ แฅแแต แฅแ แ แแญ แญแแแแข
#Dictionary
#DataTypes
@python_pioneers
โก2๐1๐ฅ1