Python Pioneers: A Beginner's Guide πŸ‡ͺπŸ‡Ή
8.65K 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
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