3. Which keyword is used to skip the rest of the code inside the loop for the current iteration only?
Anonymous Quiz
4%
A) skip
43%
B) break
43%
C) continue
9%
D) pass
4. What will be the output of the following code?
- A) 4 3 2 1 0
- B) 4 3 1 0
- C) 5 4 3 2 1
- D) 5 4 3 1 0
x = 5
while x > 0:
x -= 1
if x == 2:
continue
print(x)
- A) 4 3 2 1 0
- B) 4 3 1 0
- C) 5 4 3 2 1
- D) 5 4 3 1 0
5. Which of the following statements about the pass statement in Python is true?
Anonymous Quiz
14%
A) It terminates the loop immediately.
43%
B) It is used to skip an iteration in a loop.
38%
C) It is a null operation used as a placeholder.
5%
D) It raises an exception.
You're gonna write a python program that processes numbers from 1 to 20 and follow these rules.
1. Skip (continue) numbers that are divisible by 3.
2. Stop (break) the loop if the number is greater than 15.
Print all the other numbers
You can use for loop to iterate through the numbers 1 to 20
እስቲ ሞክሩት
#Exercise
@python_pioneers
1. Skip (continue) numbers that are divisible by 3.
2. Stop (break) the loop if the number is greater than 15.
Print all the other numbers
እስቲ ሞክሩት
#Exercise
@python_pioneers
👍2
Google or Googol
The name Google was created accidentally, it was originally supposed to be named ‘Googol’. (Googol is the digit 1 followed by 100 zeroes).
The founders checked to see if that domain name was taken, but accidentally searched for ‘google.com’ instead of ‘googol.com’.
They liked that name even better and registered the domain name on September 15, 1997
#Facts
#Google
@python_pioneers
The name Google was created accidentally, it was originally supposed to be named ‘Googol’. (Googol is the digit 1 followed by 100 zeroes).
The founders checked to see if that domain name was taken, but accidentally searched for ‘google.com’ instead of ‘googol.com’.
They liked that name even better and registered the domain name on September 15, 1997
#Facts
@python_pioneers
👍2
THE ONLY WAY TO AVOID MISTAKES IS TO GAIN EXPERIENCE; THE ONLY WAY TO GAIN EXPERIENCE IS BY MAKING MISTAKES.
This quote reminds us that mistakes are an integral part of the process of learning and growth.
መልካም ምሽት ይሁንላችሁ!
#Quotes
-> @Gr8r_Abb
💬 Buzz Quotes
@python_pioneers
❤3🔥1
በቀጣይ =>
በቀጣይ በPython List ምን እንደሆነ፣ ለምን እንደሚያስፈልገንና እንዴት መጠቀም እንዳለብን እንማራለን።
Stay tuned!
@python_pioneers
@python_pioneers
LISTS IN PYTHON
በቀጣይ በPython List ምን እንደሆነ፣ ለምን እንደሚያስፈልገንና እንዴት መጠቀም እንዳለብን እንማራለን።
Stay tuned!
@python_pioneers
@python_pioneers
👍3
Forwarded from The Coffee Talk Table
በጎፋ ዞን በናዳ አደጋ ለተፈናቀሉና ለተጎዱ የህብረተሰብ ክፍሎች ድጋፍ እናድርግ፣ በህይወት ለተረፉት እንድረስላቸው
በዞኑ የአደጋ ጊዜ ዝግጁነት ማቋቋሚያ :
የኢትዮጵያ ንግድ ባንክ ሂሳብ ቁጥር
ላይ ድጋፍ እንዲያደርጉ ተጠይቀዋል።
እስካሁን 230 ሰዎች ህይወት በዚህ አደጋ አልፏል : :
በዞኑ የአደጋ ጊዜ ዝግጁነት ማቋቋሚያ :
የኢትዮጵያ ንግድ ባንክ ሂሳብ ቁጥር
1000511561276 ላይ ድጋፍ እንዲያደርጉ ተጠይቀዋል።
እስካሁን 230 ሰዎች ህይወት በዚህ አደጋ አልፏል : :
😢2
Introduction to Lists
አንድ ፕሮግራም በምንጽፍበት ጊዜ ብዙ መረጃዎችን store እናረጋለን ከዚያም እነዚያ መረጃዎች manage ለማድረግ የሚያስቸግሩ ይሆናሉ። እነሱን ደግሞ retrieve ማረግ ፣ ማውጣት፣ ማግኘት እና መጠቀም በጣም ከባድ ይሆናል።
ስለዚህ እነዚያን መረጃዎች በቡድን/በመመደብ/ ከዚያም በአንድ variable ውስጥ store ማረግ አለብን። በProgramming ውስጥ, ይህ ሂደት እንደ Data structure ይባላል።
Data Structure is a particular way of organizing data in a computer so that it can be used effectively.
የ List ባህሪያት
1. Lists ተመሳሳይ ወይም የተለያየ (heterogeneous) data types store ማድረግ ይችላሉ
2. Lists dynamic ናቸው ማለትም we don't need to mention the size of the list while declaring.
3. Order is preserved, ወይም insert ያረግነውን data as long as there are no modifications to the list በተመሳሳይ order ነው outputኡንም የምናገኘው።
4. Lists duplicate የሆነ element መያዝ ይችላሉ
5. In lists ዋናውን ሚና የሚጫወተው index ነው፣ Index በመጠቀም ነው የlistኡን elements access የምናረገው (
6. List objects mutable ናቸው ማለትም listኡ ከተፈጠረ በኋላ የlistኡን content modify ማረግ ወይም መቀየር እንችላለን።
...to be contd
#Lists
@python_pioneers
@python_pioneers
👍2
...contd
List create ለማረግ ብዙ አይነት መንገዶች አሉ፣ እስኪ በምሳሌ እንመልከታቸው:
1. Using square brackets
በpython list square brackets በመጠቀም መፍጠር እንችላለን፣ የlistኡን elements ደግሞ በcomma እንለያያቸዋለን።
Syntax
:
list_name = [elements]
ለምሳሌ:
2. Using list() function
ሁለተኛው list መፍጠሪያ መንገድ ደግሞ list() የሚባል built-in function በመጠቀም ነው። ይሄን ደግሞ የምንጠቀመው ከተለያዩ data types like : strings, set, tuple ...etc list መፍጠር ስንፈልግ ነው።
Set, tuple, Dictionary -> በቀጣይ እንማራቸዋለን
ለምሳሌ:
3. Using list() and range() function
የrange() function sequence of numbers create ያረጋል፣ starting from 0 by default, and increments by 1 (by default), እና specified ከሆነው ቁጥር በፊት ይቆማል።
...to be contd
#Lists
@python_pioneers
@python_pioneers
How to create a List?
List create ለማረግ ብዙ አይነት መንገዶች አሉ፣ እስኪ በምሳሌ እንመልከታቸው:
1. Using square brackets
በpython list square brackets በመጠቀም መፍጠር እንችላለን፣ የlistኡን elements ደግሞ በcomma እንለያያቸዋለን።
Syntax
:
list_name = [elements]
ለምሳሌ:
my_list = [1, 2, 3, 4, 5]
2. Using list() function
ሁለተኛው list መፍጠሪያ መንገድ ደግሞ list() የሚባል built-in function በመጠቀም ነው። ይሄን ደግሞ የምንጠቀመው ከተለያዩ data types like : strings, set, tuple ...etc list መፍጠር ስንፈልግ ነው።
ለምሳሌ:
name = "ABEBE"
my_list = list(name)
print(my_list) # Output : ['A', 'B', 'E', 'B', 'E']
3. Using list() and range() function
የrange() function sequence of numbers create ያረጋል፣ starting from 0 by default, and increments by 1 (by default), እና specified ከሆነው ቁጥር በፊት ይቆማል።
...to be contd
#Lists
@python_pioneers
@python_pioneers
👍5🙏1
Test your knowledge about basics of lists in python with these👇 questions
1. Which of the following statements is true about Python lists?
Anonymous Quiz
6%
A) Lists are immutable.
84%
B) Lists can contain elements of different data types.
10%
C) Lists must contain only elements of the same data type.
0%
D) Lists do not support slicing.
2. How do you create an empty list in Python?
Anonymous Quiz
22%
A) my_list = ()
10%
B) my_list = {}
68%
C) my_list = []
0%
D) my_list = None
3. How do you create a list in Python?
Anonymous Quiz
11%
A) my_list = {1, 2, 3}
78%
B) my_list = [1, 2, 3]
11%
C) my_list = (1, 2, 3)
0%
D) my_list = "1, 2, 3"
4. Why are lists commonly used in Python?
Anonymous Quiz
3%
A) They can only store numbers
86%
B) They allow storing a sequence of items in a single variable
6%
C) They are faster than other data structures
6%
D) They can only store text data
5. Why are lists preferred for storing a collection of data items in Python?
Anonymous Quiz
9%
A) Lists automatically sort the items
6%
B) Lists are read-only and cannot be changed
73%
C) Lists allow easy addition, removal, and access of items
12%
D) Lists consume less memory compared to other data structures
❤5