1
00:00:01,730 --> 00:00:07,080
OK, in this video, we want to clear our answer box and generate new random numbers.

2
00:00:07,460 --> 00:00:09,560
So let's go ahead and take a look at this.

3
00:00:09,570 --> 00:00:13,780
Let's come over to our ad correct function.

4
00:00:13,790 --> 00:00:21,560
So when we've after we figured out whether or not the answer is correct or not, let's go ahead and

5
00:00:21,560 --> 00:00:25,910
clear the answer box.

6
00:00:26,780 --> 00:00:30,320
And to do that, let's see, what did we call the answer box?

7
00:00:30,330 --> 00:00:31,400
It was ad answer.

8
00:00:32,480 --> 00:00:33,410
We can do.

9
00:00:36,120 --> 00:00:38,760
Entry boxes have a function called delete.

10
00:00:41,530 --> 00:00:46,550
And they take a couple of arguments, the first is zero, and then the second is end.

11
00:00:46,780 --> 00:00:47,200
Now.

12
00:00:48,460 --> 00:00:52,180
Think of an entry box and you type into it the things you type into it.

13
00:00:53,380 --> 00:00:58,090
Kantor treats that as a python list and what's the first item in a python list?

14
00:00:58,390 --> 00:00:59,520
The first item is zero.

15
00:00:59,680 --> 00:01:06,150
So whenever you enter into into the entry box, that's the zeroth item of the entry box list.

16
00:01:06,430 --> 00:01:10,210
So we have to designate we want to delete that.

17
00:01:10,690 --> 00:01:12,540
Whatever you typed in the box to end.

18
00:01:12,970 --> 00:01:15,730
Well, let's take this and run it just to make sure that worked.

19
00:01:17,360 --> 00:01:22,160
So here we have our six plus four equals, let's say 12.

20
00:01:23,350 --> 00:01:31,990
So 12 is the zeroth item of this entry box, right, boom, incorrect, six plus forest and not 12,

21
00:01:31,990 --> 00:01:32,590
you idiot.

22
00:01:33,550 --> 00:01:36,040
And our entry box is now empty again.

23
00:01:36,070 --> 00:01:37,510
OK, so that was super easy.

24
00:01:37,600 --> 00:01:42,950
Now we just need to generate new random numbers, and that's fairly easy as well.

25
00:01:42,950 --> 00:01:46,270
So let's put our code back up and just blow here.

26
00:01:46,280 --> 00:01:55,630
Let's generate two new random numbers so we already have our random numbers there.

27
00:01:55,630 --> 00:02:02,770
NUM underscore one and num underscore two down here and there in VARs so we can set them any time we

28
00:02:02,770 --> 00:02:09,720
want and when we set them they should just auto update because that's what set does.

29
00:02:10,540 --> 00:02:15,430
So let's go num underscore one.

30
00:02:15,820 --> 00:02:16,540
Well actually.

31
00:02:17,640 --> 00:02:23,280
Let's just come down here and copy this again, why type when we can copy and paste?

32
00:02:24,330 --> 00:02:26,670
So this will generate new random numbers.

33
00:02:29,000 --> 00:02:30,490
No, I misspoke.

34
00:02:30,780 --> 00:02:35,720
They won't generate they won't flash up on the screen automatically, we can save this and run it just

35
00:02:35,720 --> 00:02:39,260
to make sure, but we're gonna have to do a little bit of coding to make that happen.

36
00:02:39,700 --> 00:02:43,330
I believe what I was thinking when I said that just two minutes ago.

37
00:02:43,700 --> 00:02:44,090
Yeah.

38
00:02:44,300 --> 00:02:45,670
So I didn't actually change.

39
00:02:45,680 --> 00:02:47,150
So we got to we got to update that.

40
00:02:47,450 --> 00:02:48,230
No big deal.

41
00:02:48,470 --> 00:02:52,750
So if we come down here and look at our original thing, right.

42
00:02:53,240 --> 00:02:59,780
This ad flash, that's where we're outputting the random numbers that we generate.

43
00:02:59,790 --> 00:03:04,100
Remember, we've put as font Helvetica size 30 to here it is and I'm one.

44
00:03:04,100 --> 00:03:05,160
I'm too right.

45
00:03:05,210 --> 00:03:12,590
So we can just probably grab this whole thing and copy it and then just come back up to our ad correct

46
00:03:12,590 --> 00:03:19,760
function where we've generated generated our two new random numbers and we can just redefine that.

47
00:03:20,390 --> 00:03:28,940
But instead of calling label, we want to update this so we can do our config trick and we don't need

48
00:03:28,940 --> 00:03:29,930
to put a frame.

49
00:03:29,930 --> 00:03:34,000
We just need to designate what the text is going to be, which is this.

50
00:03:34,820 --> 00:03:42,130
OK, so now this will automatically update it, just like we automatically updated these to add correct

51
00:03:42,140 --> 00:03:43,800
labels earlier.

52
00:03:43,850 --> 00:03:45,980
So, all right, let's go out and say this and run it.

53
00:03:48,000 --> 00:03:53,720
Hopefully that made sense breeze past that a little quickly, so one plus three equals one hundred twenty

54
00:03:53,720 --> 00:03:54,230
three.

55
00:03:54,530 --> 00:03:55,250
Incorrect.

56
00:03:55,520 --> 00:03:57,470
Something happened we didn't update.

57
00:03:57,470 --> 00:04:00,700
So let's see what er add flash is not defined.

58
00:04:00,710 --> 00:04:02,270
I bet I forgot to make it global.

59
00:04:02,960 --> 00:04:03,680
So let's come down here.

60
00:04:03,680 --> 00:04:04,900
You add flash.

61
00:04:04,910 --> 00:04:08,840
This is the original add flash in our original add function.

62
00:04:09,110 --> 00:04:18,230
We need to call this a global so that it can work anywhere and underscore flash I guess for flashcard.

63
00:04:18,440 --> 00:04:19,700
I don't know why we named it that.

64
00:04:19,700 --> 00:04:20,930
I'm bad at naming things.

65
00:04:20,930 --> 00:04:22,820
We haven't figured it out like right up here.

66
00:04:22,820 --> 00:04:23,600
Output answer.

67
00:04:23,600 --> 00:04:24,020
Correct.

68
00:04:24,020 --> 00:04:29,420
That's a terrible variable name, but whatever name of anything you want, I'm bad at it.

69
00:04:29,750 --> 00:04:30,950
OK, so clear.

70
00:04:31,790 --> 00:04:35,330
And let's run this again and hopefully that should work now.

71
00:04:35,960 --> 00:04:38,750
So add three plus eight hundred twenty three.

72
00:04:39,300 --> 00:04:39,650
Boom.

73
00:04:39,650 --> 00:04:40,100
Incorrect.

74
00:04:40,100 --> 00:04:42,290
Three plus eight equals eleven, not one hundred twenty three.

75
00:04:42,440 --> 00:04:46,280
Now we have five plus eight, five plus eight is I think thirteen.

76
00:04:46,700 --> 00:04:47,150
Correct.

77
00:04:47,150 --> 00:04:48,860
Five plus eight equals thirteen boom.

78
00:04:48,860 --> 00:04:52,070
Five plus seven 42 incorrect.

79
00:04:52,070 --> 00:04:55,160
Five or seven is twelve not forty two and seven.

80
00:04:55,730 --> 00:04:56,390
Seventeen.

81
00:04:56,930 --> 00:04:57,410
Correct.

82
00:04:57,590 --> 00:05:00,230
And now it just works so.

83
00:05:01,390 --> 00:05:05,650
OK, I think we're pretty much done with our ad function now, we're putting this little thing down

84
00:05:05,650 --> 00:05:06,440
here at the bottom.

85
00:05:06,460 --> 00:05:07,930
Maybe that's kind of hokey.

86
00:05:08,170 --> 00:05:10,390
Maybe we want to make a message box pop up.

87
00:05:10,420 --> 00:05:12,700
Remember, we talked about message boxes way back.

88
00:05:13,240 --> 00:05:16,360
Instead of flashing this up on the screen, you could just make it a message box.

89
00:05:16,360 --> 00:05:16,960
That would be cool.

90
00:05:17,530 --> 00:05:21,450
I'll leave that to you and see this eight plus six.

91
00:05:21,460 --> 00:05:24,010
These variables is a little small.

92
00:05:24,050 --> 00:05:30,220
See if we bought this up to seventy two, what would that look like?

93
00:05:30,490 --> 00:05:34,720
Do it down here to just playing around at this point.

94
00:05:35,050 --> 00:05:36,190
Well this might look better.

95
00:05:38,280 --> 00:05:39,780
Or they might be way too big.

96
00:05:40,060 --> 00:05:43,590
Oh, I kind of like that, the triple seven eight.

97
00:05:45,310 --> 00:05:51,160
Yeah, I think that's probably a little bit better takes up more space or whatever, you could also

98
00:05:51,160 --> 00:05:55,600
create a status bar at the bottom to put the incorrect or correct answer down.

99
00:05:55,600 --> 00:05:57,790
There might be something you could do.

100
00:05:58,630 --> 00:05:59,990
Yeah, that might be fun, right?

101
00:06:02,620 --> 00:06:03,850
Anyway, I'll leave that to you.

102
00:06:04,210 --> 00:06:09,550
These are just aesthetic things, you can make this look anywhere you want, obviously, and pretty

103
00:06:09,550 --> 00:06:09,820
cool.

104
00:06:09,820 --> 00:06:12,970
So, OK, this seems to be working.

105
00:06:13,750 --> 00:06:14,790
Thirty four.

106
00:06:15,590 --> 00:06:16,320
Six.

107
00:06:16,550 --> 00:06:16,920
Yeah.

108
00:06:18,020 --> 00:06:25,460
I think for now, we'll call this ad function done, now we just need to do these other three, which

109
00:06:25,460 --> 00:06:26,410
should be pretty easy.

110
00:06:26,420 --> 00:06:31,400
We could copy and paste a lot of stuff and we'll start to look at that in the next video.
