add integers in a list python code example
Example 1: 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)
Example 2: how to add numbers into a list python
a_list = [1, 2, 3]
integers_to_append = 4.
a_list. append(integers_to_append)
print(a_list)