xxxxxxxxxx
listA = []
for a in range(50):
if a%5==0:
listA.append(a)
xxxxxxxxxx
# plz suscribe to my youtube channel -->
# https://www.youtube.com/channel/UC-sfqidn2fKZslHWnm5qe-A
#append items to list
list_example = ["python","ruby","java","javascript","c#","css","html"]
print(list_example)
list_example.append("assembly")
print(list_example)
#output
['python', 'ruby', 'java', 'javascript', 'c#', 'css', 'html']
['python', 'ruby', 'java', 'javascript', 'c#', 'css', 'html', 'assembly']
xxxxxxxxxx
my_input = ['Engineering', 'Medical']
my_input.append('Science')
print(my_input)
xxxxxxxxxx
#!/usr/bin/env python
# simple.py
nums = [1, 2, 3, 4, 5]
nums.append(6)
xxxxxxxxxx
currencies = ['Dollar', 'Euro', 'Pound']
# append 'Yen' to the list
currencies.append('Yen')
print(currencies)
# Output: ['Dollar', 'Euro', 'Pound', 'Yen']
xxxxxxxxxx
# 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)