Finding Index positions in Lists and counting duplicates
Last updated
my_list = ['a', 'b', 'c', 'd']
idx_pos = my_list.index('a') # This will print the index position. I.e 2
# The variable will return an INTmy_list = ['a', 'b', 'c', 'd', 'c', 'c']
c_count = my_list.count('c') # The variable will return an INTNOTE:
Any SLICING that you do with a LIST returns a LIST
Any SLICING that you do with a TUPLE returns a TUPLE
Last updated