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
Forwarded from Zaphnath Paaneah
Join our channel and embark on your coding journey with us!

๐Ÿ‘‰ @python_pioneers

Gain access to free coding lessons in Amharic language. Additionally, stay updated on the latest tech news and new innovations.

PythonแŠ• แ‰ แŠ แˆ›แˆญแŠ› แŠฅแŠ•แˆ›แˆญ!

@python_pioneers
@python_pioneers
๐Ÿ‘2โค1โšก1
Arranging a List

แ‹จแŠ แŠ•แ‹ตแŠ• list elements order แ‰ แˆแŠ•แˆแˆแŒˆแ‹ แˆ˜แŠ•แŒˆแ‹ต แˆ›แ‹ตแˆจแŒ แŠฅแŠ•แ‰ฝแˆ‹แˆˆแŠ•แฃ แ‹ญแˆ„แŠ•แŠ•แˆ แ‹จแˆแŠ“แˆจแŒˆแ‹ แ‰ แŠฅแАแ‹šแˆ… methods แАแ‹แข

1. sort() method

In a list by default insertion order is preserved แˆ›แˆˆแ‰ตแˆ แˆ˜แŒ€แˆ˜แˆชแ‹ซ แˆ‹แ‹ญ แ‹จlistแŠกแŠ• element แ‰ฃแˆตแ‰€แˆ˜แŒฅแŠ•แ‰ แ‰ต แ‰ฆแ‰ณ แАแ‹ แ‹จแˆแŠ“แŒˆแŠ˜แ‹แข

If we want to sort the elements of the list according to default natural sorting order then we should go for sort() method.

แˆˆ แ‰แŒฅแˆฎแ‰ฝ default natural sorting order ascending order แАแ‹แข
แˆˆ strings default natural sorting order alphabetical order แАแ‹แข

sort() method แˆˆแˆ˜แŒ แ‰€แˆ listแŠก แ‰ฐแˆ˜แˆณแˆณแ‹ญ type แ‹ซแˆ‹แ‰ธแ‹แŠ• elements แˆ˜แ‹ซแ‹ แŠ แˆˆแ‰ แ‰ตแฃ แŠ แˆˆแ‰ แˆˆแ‹แ‹ซ we will get TypeError.

Syntax : 
list_name.sort()

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

yene_list = [4, 5, 3, 1, 2]
yene_list.sort()
print(yene_list)

Output : [1, 2, 3, 4, 5]

2. reverse() method

This method reverses the order of list elements.

Syntax :
list_name.reverse()

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

lela_list = [1, 4, 2, 8, 6]
lela_list.reverse()
print(lela_list)

Output : [8, 6, 4, 2, 1]

...

#Lists
#ArrangingLists

@python_pioneers
@python_pioneers
๐Ÿ‘1
Some programming memes

Have fun๐Ÿ˜Š

@python_pioneers
๐Ÿ˜5
๐Ÿš‘ Scientists from USA have developed an inexpensive electric bandage that speeds up wound healing by 30%.

To activate the bandage, you just need to moisten it, and it starts delivering a weak current that stimulates cells and suppresses bacterial growth.

It's a single-use product, but itโ€™s expected to cost just $1. However, thereโ€™s no production timeline yet as clinical trials are still ahead.


#Technology
#Tech
#News

@hitechdailynews
@python_pioneers
๐Ÿ‘2๐Ÿ˜จ1
๐Ÿ‘3
Nextโžก : Mathematical Operations on List (using List Methods)
Mathematical Operations on List (using List Methods)

แŠ แŠ•แ‹ต list แˆ‹แ‹ญ mathematical operations แˆˆแˆ›แŠซแˆ„แ‹ต แ‹จแˆแŠ•แŒ แ‰€แˆ›แ‰ธแ‹ แ‰ฅแ‹™ แŠ แ‹ญแАแ‰ต methods แŠฅแŠ•แ‹ตแˆแˆ แ‰ฅแ‹™ แŠฅแ‹ญแАแ‰ต functions แŠ แˆ‰แข

Let's see them one by one...

1. len()

แ‹ญแˆ„แŠ•แŠ• len() function แ‹จแˆแŠ•แŒ แ‰€แˆ˜แ‹ แ‰ แŠ แŠ•แ‹ต listแ‹แˆตแŒฅ แ‹ซแˆ‰แ‰ตแŠ• elements แ‰ฅแ‹›แ‰ต(แ‹จlistแŠกแŠ• length) แˆˆแˆ›แ‹ˆแ‰… แˆตแŠ•แˆแˆแŒ แАแ‹แข

Syntax: 
len(list_name)

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

Items = ["rubber", "pencil", "book", "pen"]
length = len(Items)

print(length)

#Output : 4

2. count() method

แ‹ญแˆ„แŠ•แŠ• method แ‹ฐแŒแˆž แ‹จแˆแŠ•แŒ แ‰€แˆ˜แ‹ แ‰ แŠ แŠ•แ‹ต list แ‹แˆตแŒฅ แ‹ซแˆˆ แ‹จแˆ†แА specific element แˆแŠ• แ‹ซแˆ…แˆ occur แŠฅแŠ•แ‹ณแˆจแŒˆ แˆˆแˆ›แ‹ˆแ‰… แˆตแŠ•แˆแˆแŒ แАแ‹แข

Syntax :
list_name.count(element)

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

alps = ["a", "e", "g", "a", "f", "g", "a"]

occurrence_of_a = alps.count("a")

print(occurrence_of_a)

#Output : 3


3. max()

max() function แ‰ แŠ แŠ•แ‹ต list แ‹แˆตแŒฅ แ‰ตแˆแ‰แŠ• element return แ‹ซแˆจแŒ‹แˆแข

Syntax :
max(list_name)

4. min()

min() function แ‹ฐแŒแˆž แ‰ แ‰ฐแ‰ƒแˆซแŠ’แ‹ แ‹จแŠ แŠ•แ‹ตแŠ• list แ‰ตแŠ•แˆนแŠ• element return แ‹ซแˆจแŒแˆแŠ“แˆแฃ

Syntax :
min(list_name)

max() แŠฅแŠ“ min() function แ‰ แˆแˆณแˆŒ แŠฅแŠ•แˆ˜แˆแŠจแ‰ตแข

nums = [5, 90, 34, 65, 23, 7, 10]

print(max(nums)) #Output : 90

print(min(nums)) #Output : 5

...

#MathsOpOnLists
#Lists

@python_pioneers
๐Ÿ‘1
Here are some multiple choice questions: Answer them by reacting for the correct ones as stated below ๐Ÿ‘‡

A == ๐Ÿ˜
B == ๐Ÿ˜ญ
C == ๐Ÿ˜ข
D == ๐Ÿค“
1. What is the result of the following operation?

list1 = [1, 2, 3]
list2 = [4, 5, 6]
result = list1 + list2

- ๐Ÿ˜) [1, 2, 3, 4, 5, 6]

-๐Ÿ˜ญ) [5, 7, 9]

-๐Ÿ˜ข) [(1, 4), (2, 5), (3, 6)]

-๐Ÿค“) None of the above
๐Ÿ˜8
2. What does the following Python code return?

list1 = [1, 2, 3]
result = list1 * 2

- ๐Ÿ˜) [2, 4, 6]

-๐Ÿ˜ญ) [1, 2, 3, 1, 2, 3]

-๐Ÿ˜ข) [1, 1, 2, 2, 3, 3]

-๐Ÿค“) None of the above
๐Ÿ˜ญ6๐Ÿ˜1
Nice question

In case of lists containing strings, when we use max() and min() function, they return the maximum or minimum element based on lexicographical order

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

"name" has higher lexicographic order than "age", so if we use max() for a list containing only the two, the function returns "name"

But also there's something called key, in which you specify the criteria you want to compare by

Is this helpful ๐Ÿ‘†
๐Ÿ‘2