Quick actions

cmd+k|ctrl+k

Navigation

Languages

List Method 2

Snippet info

Language

Python

Visibility

public

Author

ak.amita28

Created

2026-04-14T11:33:53.894799Z

Updated

2026-04-14T11:33:53.894799Z

basket = ['a','b','c','d','e','d']

print(basket.count('d')) #COunt of d in the arrary basket
print(basket.index('d',0,4))  #Index of d starts with 0 and ends at 4 in the basked array
print('b' in 'duplicate not done')
print('d' in 'duplicate not done')

# basket.sort() - sort as method
print(basket)

print(sorted(basket)) #sort as function - function does't modify the array - it creates a new copy of array
print(basket)

basket.reverse()
print(basket)

print(basket[::-1]) # slicing for reverse

print(list(range(1,100)))

print(list(range(101)))
INFO