Tambahkan elemen ke daftar python menggunakan metode append ()


# Addition of elements in a List
 
# Creating a List
List = []
print("Initial blank List: ")
print(List)
 
# Addition of Elements
# in the List
List.append(7)
List.append(2)
List.append(4)
print("\nList after Addition of Three elements: ")
print(List)
 
# Adding elements to the List
# using Iterator
for i in range(5, 10):
    List.append(i)
print("\nList after Addition of elements from 5-10: ")
print(List)
 
# Adding Tuples to the List
List.append((5, 6))
print("\nList after Addition of a Tuple: ")
print(List)
 
# Addition of List to a List
List2 = ['softhunt', '.net']
List.append(List2)
print("\nList after Addition of a List: ")
print(List)
Outrageous Ostrich