00:01
Okay, for this problem, we want to be able to input a series of integers and then tell how many positives, negatives, the total average, and things like that.
00:11
And so the first thing that we probably want to do is just give a list of variables.
00:19
Val equals 1, that actual 1 doesn't matter.
00:22
I do want to know that we're starting off with zero positives.
00:29
We're starting off with zero negatives.
00:36
The total that we begin with is also zero.
00:41
And then i'm just going to use the word numb.
00:44
That's going to keep track of how many numbers that we actually enter.
00:48
And to start with we don't have any.
00:51
Now we want to do a loop.
00:53
And there's a couple of things we can do with the while loop.
00:56
One technique i like to use for problems like this is just say wall true, which could create an imminent while loop if we're not careful.
01:05
But if we have an if statement that allows us to break out of the loop, it allows us to very easily test what we want.
01:13
And so before we do any of that, we need to get the value.
01:17
And that's going to be an input statement.
01:21
And then the inside the input statement is the text that you want when you're going to.
01:27
Getting the value.
01:28
So enter an integer and then we say zero when done.
01:36
We put a colon in the quote end the parentheses.
01:42
And if we wanted to run it right now, we'd be able to just get a whole bunch of integers.
01:47
Even we typed in zero, it would just keep taking integers.
01:51
It's not really doing anything with integers, but we at least know that that loop is now working.
01:58
And so one thing we want to do is then test that if that val is equal to zero, we want to do two things.
02:13
One is we want to say, actually, i don't want to do that yet.
02:23
I'm just going to do a break statement right here.
02:27
And that's fine.
02:30
And what that does for us is when we, what did i do wrong, val equal.
02:37
Double equals whenever we're testing.
02:41
If i type in my integers, as soon as i type in a zero, i'm done and the program exits, which is what we're looking for to do.
02:50
So now if we type in a value and it's not a zero, we want to increment a lot of the values.
02:57
And so plus equals allows us to increment.
03:00
So we're going to add one to number.
03:03
We're going to add one to number.
03:06
Add one to the positives.
03:12
We're going to add one to the negatives.
03:17
And then our total is going to be increased or decreased of a negative by whatever the value.
03:27
Whatever the value is...