- Home
- Course Detail
regularpython@gmail.com
You are now watching:
Python Lists / of Python List Operators
fruits = ["orange", "mangoes", "banana", "apples"] # How to find length of a list? print(len(fruits)) # How to concatenate two lists in python? fruits = ["orange", "mangoes", "banana", "apples"] ranks = [1, 2, 3] c = fruits+ranks print(c) fruits.extend(ranks) print(fruits) # How to get repetations in lists? fruits = [1 , 2 , 3] print(fruits * 4 ) # How to use membership conditions in list? fruits = ["orange", "mangoes", "banana", "apples"] if "orange" in fruits: print("search fruit available in fruits list") else: print("fruit not fount") # How to use for loop in Lists? fruits = ["orange", "mangoes", "banana", "apples"] for fruit in fruits: print(fruit) # How to find max values in list? fruits = ["orange", "mangoes", "banana", "apples"] print(min(fruits)) ranks = [1, 2, 3, 4, 5, 6] print(min(ranks)) # How to find minimum value in list? fruits = ["orange", "mangoes", "banana", "apples"] print(min(fruits)) ranks = [1, 2, 3, 4, 5, 6] print(min(ranks))