00:01
Welcome to this lesson.
00:02
In this lesson we will define a function that accepts a list as argument and retains the sum of the total values in the list.
00:12
So for example if we put in, so say input, input 3, 4, 6, then our output should be 3 plus 4 plus 6 which is 13.
00:32
Alright so let's go on.
00:35
Let me write output.
00:44
Okay let's go on.
00:48
Let's define the list as sum.
00:53
Okay.
00:54
We take a list.
00:58
Then i'm going to define a variable called results.
01:02
Results will simply be an integer because we will take in the list of integers.
01:13
Then i'm going to go through all the items in the list and sum them individually.
01:20
So i'm going to say for i in the list.
01:26
I'm going to do results plus equals to i.
01:35
Alright so i'm going to do the addition assignment to actually add all the items in the list to the results.
01:49
Then after that i'm simply going to return the results.
01:55
Alright so let me use the if the main method to test this.
02:00
I'll say if underscore underscore name is equals to main then i'll simply say the list is equals to 3, 4, 6, 7, 8, 9...