1
00:00:01,690 --> 00:00:06,570
OK, so in this video, we're going to start to build out the functionality of the math flashcard thing,

2
00:00:06,580 --> 00:00:10,040
so the first thing we need to do is generate some random numbers.

3
00:00:10,040 --> 00:00:15,090
So we need, you know, any time we run this thing, we need some random numbers to be flashed up onto

4
00:00:15,100 --> 00:00:15,610
the screen.

5
00:00:15,730 --> 00:00:17,270
How do we create those random numbers?

6
00:00:17,290 --> 00:00:22,810
Well, with Python, it's pretty simple to create random numbers, but we need to import a little something

7
00:00:22,810 --> 00:00:23,260
to do it.

8
00:00:23,270 --> 00:00:25,630
So let's go from random.

9
00:00:27,620 --> 00:00:35,720
Import rand it and this random comes with Python, so we don't have to pip install it, it's already

10
00:00:35,720 --> 00:00:36,080
there.

11
00:00:36,200 --> 00:00:42,620
But inside of this random module we have this random event and that will create random integers.

12
00:00:42,620 --> 00:00:48,550
So random numbers can be anything that could be one point six nine four three eight six two four.

13
00:00:48,830 --> 00:00:50,450
We don't want that with our flash cards.

14
00:00:50,450 --> 00:00:53,150
We we want nice round numbers, nice integers.

15
00:00:53,180 --> 00:00:55,730
Seven twelve, one hundred and six.

16
00:00:55,730 --> 00:00:56,030
Right.

17
00:00:56,240 --> 00:00:57,950
Integer numbers, whole numbers.

18
00:00:58,160 --> 00:01:00,410
So we would use Rande int for that.

19
00:01:00,650 --> 00:01:06,500
So now let's come down to our ad function here and let's create a couple of random numbers.

20
00:01:06,500 --> 00:01:13,100
So let's go num underscore one equals and num underscore two equals.

21
00:01:13,100 --> 00:01:20,360
And to do this we just call the rand and function and then we sort of tell it what kind of numbers we

22
00:01:20,360 --> 00:01:20,650
want.

23
00:01:20,660 --> 00:01:23,330
I want something between zero and 10.

24
00:01:23,870 --> 00:01:25,790
So zero could be a number.

25
00:01:26,000 --> 00:01:27,050
It could be zero.

26
00:01:27,170 --> 00:01:27,890
It could be one.

27
00:01:27,890 --> 00:01:28,610
It could be two.

28
00:01:28,610 --> 00:01:31,220
It could be all the way up to and including ten.

29
00:01:31,220 --> 00:01:36,000
So we may get ten plus zero, we may get anything in between.

30
00:01:36,020 --> 00:01:42,320
So if you don't want 10, if you only wanted to go up to nine, you would do nine there.

31
00:01:42,320 --> 00:01:44,450
But we want between zero and ten.

32
00:01:44,450 --> 00:01:46,670
If we didn't want zero, we could put one.

33
00:01:46,790 --> 00:01:49,040
So this would just be one through 10.

34
00:01:49,040 --> 00:01:50,390
Zero would never appear.

35
00:01:50,660 --> 00:01:51,680
But I kind of like zero.

36
00:01:51,680 --> 00:01:53,060
So let's just go ahead and do that.

37
00:01:53,540 --> 00:01:55,010
So let's copy this and paste.

38
00:01:55,040 --> 00:01:57,830
So now we have these two numbers and we can do anything we want with them.

39
00:01:58,610 --> 00:02:01,820
So let's make a commentary just so we're on the same page.

40
00:02:03,020 --> 00:02:07,370
Create two random numbers.

41
00:02:08,270 --> 00:02:15,110
OK, so now let's put our random numbers.

42
00:02:16,730 --> 00:02:18,020
Onto the screen.

43
00:02:19,180 --> 00:02:28,510
So let's create a label, let's call this ad label or ad flash or whatever, and this is a label and

44
00:02:28,510 --> 00:02:29,640
it's not root.

45
00:02:29,650 --> 00:02:32,950
It is in our ad underscore frame.

46
00:02:34,470 --> 00:02:37,300
Right, and we want the tax to equal what?

47
00:02:37,950 --> 00:02:38,310
Well.

48
00:02:39,740 --> 00:02:43,400
First, we want no underscore.

49
00:02:44,860 --> 00:02:51,550
One, but we want to concatenate this, so let's put plus and let's put a space and then we want to

50
00:02:51,550 --> 00:02:56,660
put the plus sign and we want to concatenate again and put num underscore two.

51
00:02:56,950 --> 00:03:04,930
Now, you can't concatenate numbers with strings, so we actually need to convert these into strings

52
00:03:04,930 --> 00:03:08,020
by wrapping them in the string function.

53
00:03:08,650 --> 00:03:10,680
And it's just convert's numbers to strings.

54
00:03:10,690 --> 00:03:12,610
So it now treats it like text.

55
00:03:13,030 --> 00:03:13,360
Right.

56
00:03:13,780 --> 00:03:16,630
OK, so now let's make the font bigger.

57
00:03:16,840 --> 00:03:19,710
So font equals and let's call a whole.

58
00:03:20,960 --> 00:03:24,830
Vertica, and let's try a size 30 to.

59
00:03:25,970 --> 00:03:30,610
It seems good and now we can add underscore.

60
00:03:31,840 --> 00:03:32,730
Flash.

61
00:03:33,790 --> 00:03:34,780
Dot hack.

62
00:03:36,300 --> 00:03:40,450
And let's get this iPad, why 10 just to smash it down a little bit?

63
00:03:40,500 --> 00:03:42,840
OK, so let's save this and run it and see if that worked.

64
00:03:44,680 --> 00:03:50,320
You're flashcard apps, ad boom, six plus six, OK, that seems to work, not get rid of this blue

65
00:03:50,320 --> 00:03:52,120
collar workers who man?

66
00:03:53,120 --> 00:03:58,410
That's tough on the eyes, so let's come down here to this and let's just get rid of that whole thing.

67
00:03:58,930 --> 00:04:02,090
OK, so back up to you or add thing.

68
00:04:02,090 --> 00:04:04,580
Now let's create an entry box.

69
00:04:05,240 --> 00:04:09,680
So answer box, let's call it.

70
00:04:11,030 --> 00:04:14,540
And let's just call this ad underscore answer.

71
00:04:15,700 --> 00:04:17,830
And this is a entry box.

72
00:04:19,680 --> 00:04:23,640
Right, and it's in our ad underscore frame.

73
00:04:24,690 --> 00:04:26,410
And that's really all we have to do there.

74
00:04:27,570 --> 00:04:30,240
Let's go and underscore answer.

75
00:04:33,260 --> 00:04:36,860
And let's give this iPad, why of what, five or so?

76
00:04:38,520 --> 00:04:49,770
And then let's call an answer button and let's call this ad button equals it's button, we want to put

77
00:04:49,770 --> 00:04:52,380
it in ad underscore frame.

78
00:04:53,520 --> 00:04:56,230
I want the text to say answer.

79
00:04:57,940 --> 00:05:01,030
And we want the command wealth to be nothing yet.

80
00:05:02,270 --> 00:05:06,040
Well, we'll change that in a minute, so add buttoned up pack.

81
00:05:07,460 --> 00:05:11,810
And that should be fine, so, OK, let's save this and run it to see how we're doing here.

82
00:05:14,230 --> 00:05:16,960
So we got to add 10 plus three.

83
00:05:18,170 --> 00:05:22,310
Doesn't actually do anything yet, but OK, it's starting to look good now, maybe I might push this

84
00:05:22,310 --> 00:05:28,010
down a little bit because I don't like this button being right up against there, but so far, so good.

85
00:05:29,790 --> 00:05:34,040
And moving right along, so in fact, let's go ahead and change that right now.

86
00:05:35,230 --> 00:05:43,870
Where we're at here, yeah, let's give this a pat why of five, save it and run it again just to make

87
00:05:43,870 --> 00:05:45,580
sure we're on the right page.

88
00:05:48,530 --> 00:05:52,610
All right, Alex, a little bit better, so, OK, come right along in the next video, we'll start

89
00:05:52,610 --> 00:05:56,660
to work on the functionality of answering the questions and if it's right or wrong or not.

90
00:05:56,900 --> 00:05:58,070
And that'll be in the next video.
