how to append existing integers in a list python code example
Example 1: append integer to list python
foo = [1, 2, 3, 4, 5]
foo.append(4)
foo.append([8,7])
print(foo) # [1, 2, 3, 4, 5, 4, [8, 7]]
Example 2: how do i add the integers in a list with itsself in python
x = [2, 4, 7, 12, 3]
sum_of_all_numbers= sum(x)
or
x = [2, 4, 7, 12, 3]
sum_of_all_numbers= reduce(lambda q,p: p+q, x)