1
00:00:01,700 --> 00:00:06,680
OK, so we've got our app going here, we can put some numbers on the screen, but it doesn't actually

2
00:00:06,680 --> 00:00:09,290
do anything, so let's start to work on that in this video.

3
00:00:09,300 --> 00:00:11,750
So first things first.

4
00:00:11,750 --> 00:00:14,590
Let's come through here and let's look at our random numbers now.

5
00:00:14,870 --> 00:00:19,100
We just created these random numbers and we slapped them into regular variables.

6
00:00:19,310 --> 00:00:24,410
Well, now we want to be able to click the button and then fire a function and then check to see whether

7
00:00:24,410 --> 00:00:28,400
our answer is the correct answer based on those random numbers.

8
00:00:28,430 --> 00:00:34,760
So we kind of need to be able to access these things outside of here and sort of thinking forward into

9
00:00:34,760 --> 00:00:35,360
the app.

10
00:00:35,720 --> 00:00:39,830
After we answer the first flash card, we're going to want to generate new random numbers.

11
00:00:40,050 --> 00:00:44,990
So instead of just using regular variables, let's go ahead and use those special Kintyre variables

12
00:00:44,990 --> 00:00:49,020
that we've talked about off and on throughout the course, infa and string bar.

13
00:00:49,040 --> 00:00:50,310
So these are integers.

14
00:00:50,310 --> 00:00:54,670
So we want to create int bars for them and we want these to work everywhere.

15
00:00:54,680 --> 00:01:01,130
So let's just go ahead and right off the bat, make these global so global name equals one and global

16
00:01:01,490 --> 00:01:02,870
number two.

17
00:01:03,140 --> 00:01:06,980
And like I said, let's turn these into int bars.

18
00:01:08,660 --> 00:01:17,630
So number one and underscore two equals in VA, and now we want to set them up so we can call number

19
00:01:17,690 --> 00:01:19,190
one and set.

20
00:01:20,400 --> 00:01:25,870
And number two, dot set and what do we want to set them as well?

21
00:01:25,890 --> 00:01:28,890
We just want to set them as these random numbers so we can just.

22
00:01:29,830 --> 00:01:33,760
Copy and paste and then just get rid of this completely.

23
00:01:34,090 --> 00:01:40,000
So now down here where we're actually flashing them onto the screen whenever we want to access them,

24
00:01:40,000 --> 00:01:42,880
we don't access them as number one, number two anymore.

25
00:01:43,150 --> 00:01:44,350
Now we have to get it.

26
00:01:44,500 --> 00:01:46,050
Remember, we have to get or set.

27
00:01:46,390 --> 00:01:54,550
So here we just go get and that's a function and here numb to dot get and that's a function as well.

28
00:01:54,970 --> 00:01:58,480
And if we save this and run it just to make sure this is working.

29
00:02:00,440 --> 00:02:09,740
We can see it's working if we don't get or set those kind of interesting it, see what this does if

30
00:02:09,740 --> 00:02:15,050
we save this and run it and now we see Piver zero, right.

31
00:02:15,070 --> 00:02:18,010
So that's what happens if you forget to get or set them.

32
00:02:18,590 --> 00:02:22,010
So just be sure to go ahead and get those.

33
00:02:22,160 --> 00:02:24,980
OK, so now our random numbers are set.

34
00:02:24,990 --> 00:02:29,920
Now we want to actually create a function that runs whenever we click the button.

35
00:02:29,930 --> 00:02:32,360
So let's come down here to our button.

36
00:02:33,250 --> 00:02:39,040
And let's add a command and what do we want to call this, let's call this ad correct?

37
00:02:39,070 --> 00:02:39,370
I don't know.

38
00:02:39,390 --> 00:02:46,860
We're trying to find the correct answer, but we actually want to pass our our numbers through here.

39
00:02:47,290 --> 00:02:53,110
We may be able to get away with just getting them since we called these global, but it's probably better

40
00:02:53,320 --> 00:02:55,810
just to pass them in right here.

41
00:02:55,810 --> 00:03:01,900
So we would go now to underscore one dot, get comma numb, underscore.

42
00:03:01,900 --> 00:03:04,210
Want to dot get.

43
00:03:05,180 --> 00:03:12,650
But then you can't call functions and pass things into them in a button like this, like you would normally

44
00:03:12,650 --> 00:03:13,340
with Python.

45
00:03:13,480 --> 00:03:14,780
Instead you have to use a lambda.

46
00:03:14,790 --> 00:03:17,600
I think we maybe talked about this in the past.

47
00:03:18,620 --> 00:03:21,620
It's just LMB day.

48
00:03:22,040 --> 00:03:25,280
And notice, when we do, it kind of turns cursives almost.

49
00:03:25,400 --> 00:03:27,290
And this looks like a capital L it's not.

50
00:03:27,290 --> 00:03:28,040
It's a lowercase.

51
00:03:28,050 --> 00:03:31,640
I'll be sure and take note of that.

52
00:03:31,970 --> 00:03:34,730
OK, so now we can grab this ad.

53
00:03:34,730 --> 00:03:35,240
Correct.

54
00:03:35,240 --> 00:03:39,650
And we can come up here and let's create a function to determine.

55
00:03:43,770 --> 00:03:49,020
Answer, correct, right, but now we want to pass in and I'm just going to call these number one and

56
00:03:49,020 --> 00:03:53,220
number two, I'm not putting the underscores here because these are different variables now.

57
00:03:53,580 --> 00:03:59,220
And I just want to keep track of the fact that they are different and OK, we can now pass this.

58
00:03:59,510 --> 00:04:00,300
OK, so.

59
00:04:01,820 --> 00:04:05,180
Let's go ahead and save this and run just to make sure we don't get any errors.

60
00:04:05,210 --> 00:04:07,910
I don't think we will, but you never know.

61
00:04:07,910 --> 00:04:10,870
So math flashcards, eight plus zero twenty three.

62
00:04:11,000 --> 00:04:15,700
Nothing still happens because we haven't built out that function, but we didn't get any errors.

63
00:04:15,700 --> 00:04:21,140
So at least the button thing here, we did this correctly and we should be good to go.

64
00:04:21,350 --> 00:04:24,980
So now we need to start to work on this ad correct function.

65
00:04:25,130 --> 00:04:27,110
And I think we'll look at that in the next video.
