Daftar di Python
list = ["string", 69, 6.9, True]
cool dude
list = ["string", 69, 6.9, True]
# List
a = []
# Dictionary
b = {}
# Tuple
c = ()
# Set
d = {1,2,3}
list = [132, 31212, 12, 2, 12]
print(list[3])
#output: 2
list = [1, 2, 3, 4, 5, 6]
print(list)
# It will assign value to the value to second index
list[2] = 10
print(list)
# Adding multiple element
list[1:3] = [89, 78]
print(list)
# It will add value at the end of the list
list[-1] = 25
print(list)
list = [0,1,2,3,4]
print("printing original list: ");
for i in list:
print(i,end=" ")
list.remove(2)
print("\nprinting the list after the removal of first element...")
for i in list:
print(i,end=" ")
my_list = ['p', 'r', 'o', 'b', 'l', 'e', 'm']
# Output: True
print('p' in my_list)
# Output: False
print('a' in my_list)
# Output: True
print('c' not in my_list)