Length of List
len() is used to determine the length of any list in python.
Syntax- len(List_name)
L=["apple", 12, "banana", 34]
print(len(L))
type() function
This function is used to determine the data type of items in list.
Syntax- type(List_name)
L=["apple", "banana", "ABC"]
print(type(L))
list() Builder
list() function is used to construct a list from given items.
Syntax- list()
T=("apple", "banana", "cherry")
L= list(T)
print(L)
Access Items in List
List Items of are indexed and we can access items by referring to the index number.
Syntax- list[index number]
L= ["apple", "banana", "cherry"]
print(L[2])
Membership Operator (in/not in)
It is use to determine if a specified item is present or not in a list , we use in or not in keywords respectively.
L= ["apple", "banana", "cherry"]
if "apple" in L:
print("Yes, 'apple' is in the fruits list")
L= ["apple", "banana", "cherry"]
if "banana" not in L:
print("Yes, 'banana' is in the fruits list")
max()
It is used to find the maximum value in the list.
L= [ 10,20,5,23,4]
B=max(L)
print(" Maximum item is ", B)
