Python - How to Iterate Through a List using for loop and the enumerate() Function - Code Example

preview_player
Показать описание
A for loop is typically used to iterate a list. An IndexError occurs when you try to access an element outside the range of the list. The enumerate() function iterates a list and provides a counter variable. Several useful list functions exist that also iterate over a list

Function - Description
all(list)- True if all element in list are True (!= 0), or True  if the list is empty.
any(list) - True if any element in the list is True.
max(list) - Returns the maximum element in the list
min (list) - Returns the minimum element in the list
sum(list) - Returns the sum of all list elements

Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!
Рекомендации по теме