“Daftar Operasi di Python” Kode Jawaban

Daftar di Python

list = ["string", 69, 6.9, True]
cool dude

Daftar di Python

# List 
a = []
# Dictionary
b = {}
# Tuple
c = ()
# Set
d = {1,2,3}
Frail Falcon

Daftar di Python

list = [132, 31212, 12, 2, 12]
print(list[3])
#output: 2
Donald Duck

Daftar di Python

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)  
Donald Duck

Daftar di Python

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=" ")  
Donald Duck

Daftar Operasi di Python

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)
SAMER SAEID

Jawaban yang mirip dengan “Daftar Operasi di Python”

Pertanyaan yang mirip dengan “Daftar Operasi di Python”

Lebih banyak jawaban terkait untuk “Daftar Operasi di Python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya