1
00:00:01,560 --> 00:00:06,930
OK, so we've got addition, subtraction, multiplication down now we need to do a division and it's

2
00:00:06,930 --> 00:00:10,770
mostly like the last three, but we're going to have to make a couple of tweaks and I'll show you why

3
00:00:11,040 --> 00:00:11,940
in just a second.

4
00:00:11,940 --> 00:00:17,430
But for now, let's just go ahead and go through here and do the same thing we did with the other three

5
00:00:17,460 --> 00:00:18,120
or the other two.

6
00:00:18,120 --> 00:00:18,750
I should say.

7
00:00:18,940 --> 00:00:25,740
Let's find our ad correct functions and our ad function and go ahead and copy it.

8
00:00:25,750 --> 00:00:33,480
And I'm going to come down here to where we have our divide function and just paste it and then let's

9
00:00:33,660 --> 00:00:38,280
see first changes to the vision, you know, the drill.

10
00:00:38,280 --> 00:00:40,200
We've gone through this couple times already.

11
00:00:41,510 --> 00:00:44,190
Let's see, here will go division as well.

12
00:00:44,970 --> 00:00:51,270
OK, so here, right off the bat, let's just change that to divide and let's change this to divide.

13
00:00:51,310 --> 00:00:56,730
And I'm just going to copy this again so I can paste and then just come through here and start pasting.

14
00:00:57,570 --> 00:01:01,770
So add answer becomes divide, answer, add correct.

15
00:01:02,610 --> 00:01:05,010
See divide correct.

16
00:01:05,910 --> 00:01:10,920
Boom one them to add flash becomes divide flash.

17
00:01:10,920 --> 00:01:12,120
And what else do we got.

18
00:01:14,300 --> 00:01:21,110
Look at answer here becomes divine answer, and here's our logic, let's just go ahead, or at least

19
00:01:21,110 --> 00:01:25,940
our output, let's change us to divide and that to divide.

20
00:01:26,790 --> 00:01:28,510
OK, what else?

21
00:01:28,530 --> 00:01:29,800
Divide, divide, divide.

22
00:01:29,820 --> 00:01:32,760
All right, so here we have our divide.

23
00:01:36,860 --> 00:01:40,850
Boom, boom, boom, add flash becomes divide flash.

24
00:01:42,020 --> 00:01:46,280
A couple of places, if I could frame.

25
00:01:47,870 --> 00:01:48,980
What else?

26
00:01:51,610 --> 00:01:56,980
That answer becomes a divide answer here, here.

27
00:01:58,020 --> 00:01:59,790
Here and here.

28
00:02:01,480 --> 00:02:03,670
Add button becomes a divide button.

29
00:02:08,550 --> 00:02:12,090
And our lamda becomes divide, correct?

30
00:02:13,900 --> 00:02:16,290
And let's see, here we go there.

31
00:02:17,840 --> 00:02:22,830
They're there and they're OK.

32
00:02:23,030 --> 00:02:23,850
So did that work?

33
00:02:24,250 --> 00:02:24,970
Well, let's run it.

34
00:02:25,010 --> 00:02:27,290
See, almost certainly did not.

35
00:02:30,110 --> 00:02:31,280
I always miss something, right?

36
00:02:32,030 --> 00:02:34,500
All right, so divide three plus one.

37
00:02:34,520 --> 00:02:36,800
Well, that's wrong, obviously.

38
00:02:37,430 --> 00:02:38,990
OK, so let's change that.

39
00:02:39,420 --> 00:02:40,400
Or is that at.

40
00:02:42,920 --> 00:02:43,820
All right here.

41
00:02:44,780 --> 00:02:48,560
So that's divide flash, then we also need to do it up here as well.

42
00:02:48,780 --> 00:02:50,900
OK, so maybe that worked.

43
00:02:52,050 --> 00:02:52,850
Let's give it a try.

44
00:02:56,390 --> 00:03:02,360
All right, so seven divided by eight is, I don't know, one point two oh, we got something going

45
00:03:02,360 --> 00:03:02,890
on here.

46
00:03:02,900 --> 00:03:04,750
So invalid, literal.

47
00:03:04,760 --> 00:03:10,820
OK, so here is the problem now with everything else we've been dealing with whole numbers, right?

48
00:03:10,970 --> 00:03:13,220
Integers with division.

49
00:03:13,910 --> 00:03:15,890
There's a couple of problems we have to deal with.

50
00:03:16,070 --> 00:03:18,590
One is what we just saw.

51
00:03:18,620 --> 00:03:21,070
We're dealing with float's here, not integers.

52
00:03:21,080 --> 00:03:22,310
So we need to change that.

53
00:03:22,670 --> 00:03:25,130
But also, let me pull the calculator real quick.

54
00:03:25,130 --> 00:03:30,620
Let's take eight divided by zero boom cannot divide by zero.

55
00:03:30,650 --> 00:03:31,010
Right.

56
00:03:31,040 --> 00:03:37,760
That's we learn that in like grade school math, if we go zero divided by some other number, we can

57
00:03:37,760 --> 00:03:38,210
do that.

58
00:03:38,210 --> 00:03:38,870
That's zero.

59
00:03:38,870 --> 00:03:43,190
But any number divided by zero we can't do.

60
00:03:43,190 --> 00:03:44,270
It's infinity, I think.

61
00:03:44,270 --> 00:03:46,510
So we need to also change that as well.

62
00:03:46,880 --> 00:03:52,460
So let's change that real quick, because that's an easy one, that we can just change our name to random

63
00:03:52,460 --> 00:03:54,440
integer from zero to one.

64
00:03:54,440 --> 00:03:57,050
So now zero won't show up.

65
00:03:57,620 --> 00:04:00,590
And we also need to do that in our original.

66
00:04:01,490 --> 00:04:02,270
That was the original.

67
00:04:02,270 --> 00:04:07,640
Let's go into the oh, that wasn't C there in our divide function here.

68
00:04:08,270 --> 00:04:11,030
So num to change that to one.

69
00:04:11,030 --> 00:04:12,500
So that changes that.

70
00:04:12,890 --> 00:04:20,840
But then also we need to deal with the fact that these aren't integers anymore, these are floats.

71
00:04:21,200 --> 00:04:24,320
So here we can come back here and we can see where we're getting this error.

72
00:04:24,320 --> 00:04:26,210
So looks like.

73
00:04:27,970 --> 00:04:34,930
A couple of places, two, three, four and one ninety six, so let's just look at, well, two thirty

74
00:04:34,930 --> 00:04:36,580
four that's.

75
00:04:37,680 --> 00:04:39,840
Here are divide button.

76
00:04:41,700 --> 00:04:43,470
All right, I don't see the problem there.

77
00:04:43,710 --> 00:04:45,840
That was the other one, 996.

78
00:04:48,370 --> 00:04:55,510
So here we're trying to say, hey, our divide answer is an integer, so we could just changes to float

79
00:04:56,020 --> 00:04:57,410
and hopefully that'll do the trick.

80
00:04:57,430 --> 00:04:59,770
So let's come back here and run this.

81
00:05:00,240 --> 00:05:04,750
Actually, it's clear the screen is we get another error and need to look at it.

82
00:05:06,950 --> 00:05:09,590
All right, so divide zero divided by four.

83
00:05:09,680 --> 00:05:11,390
That is definitely zero.

84
00:05:12,630 --> 00:05:17,550
Critics are divided by four is zero, and notice it's a zero point zero because it's changed into a

85
00:05:17,550 --> 00:05:17,910
float.

86
00:05:18,030 --> 00:05:20,900
A float is a decimal floating point number, right.

87
00:05:21,240 --> 00:05:24,750
So to divide it by one, that is two as well.

88
00:05:24,750 --> 00:05:25,670
I think so.

89
00:05:25,680 --> 00:05:27,090
Nine divided by five.

90
00:05:27,090 --> 00:05:27,810
What is that?

91
00:05:28,140 --> 00:05:30,060
One point six?

92
00:05:30,080 --> 00:05:30,530
Seven.

93
00:05:30,540 --> 00:05:31,320
I have no idea.

94
00:05:32,160 --> 00:05:40,770
Incorrect, it is one point eight, not one point six seven, so, OK, now this works at zero and we're

95
00:05:40,770 --> 00:05:41,190
good to go.

96
00:05:41,190 --> 00:05:43,560
So the divide one is a little funky, right?

97
00:05:43,830 --> 00:05:46,190
Because we have nine divided by seven.

98
00:05:46,200 --> 00:05:46,880
What is that?

99
00:05:46,890 --> 00:05:49,980
That is one point.

100
00:05:50,880 --> 00:05:52,400
What, two?

101
00:05:53,160 --> 00:05:54,200
I don't know, five.

102
00:05:54,630 --> 00:05:59,180
Not even going to try and correct it as one point two eight five seven one.

103
00:05:59,240 --> 00:06:01,080
Like nobody's ever going to guess that, so.

104
00:06:04,100 --> 00:06:13,520
This is not a great maybe what I would do is write some code to do more than just one to ten, I would

105
00:06:13,520 --> 00:06:20,780
do one to one hundred, and then maybe I would only use even numbers or something that are integrally

106
00:06:20,780 --> 00:06:21,530
divisible.

107
00:06:21,920 --> 00:06:24,020
And you could write some code to do that.

108
00:06:25,640 --> 00:06:26,810
But that's kind of a hassle.

109
00:06:26,810 --> 00:06:29,930
And I'll leave that to you is way beyond the scope of this course.

110
00:06:29,930 --> 00:06:33,650
But, you know, that's just kind of.

111
00:06:34,580 --> 00:06:38,830
The thing about division, so maybe you leave off division, I don't know, I'll leave that up to you.

112
00:06:39,440 --> 00:06:42,220
But as far as we're going here, this seems to work.

113
00:06:42,230 --> 00:06:44,240
Now, we have one more little problem.

114
00:06:44,240 --> 00:06:47,540
If we now click on something else, zero five.

115
00:06:47,540 --> 00:06:52,730
Now, if we go back to divide, oh, it's generating it again down below.

116
00:06:52,730 --> 00:06:54,230
So we need to deal with that.

117
00:06:54,440 --> 00:06:55,910
And we'll look at that in the next video.
