WEBVTT

0
00:00.420 --> 00:05.420
Now it's finally time to put all of our skills to use by creating our automated

1
00:05.850 --> 00:06.870
birthday wisher

2
00:07.200 --> 00:10.920
which is going to send our family or friends

3
00:11.340 --> 00:15.660
a "Happy Birthday" email on their birthday automatically.

4
00:15.960 --> 00:19.980
Now the idea for this project actually came from my mum. Well,

5
00:20.040 --> 00:20.970
inadvertently.

6
00:21.360 --> 00:25.350
Now I love my mom to death and she is my biggest source of motivation and

7
00:25.380 --> 00:28.590
inspiration. But on her birthday,

8
00:28.830 --> 00:33.830
she always expects me to send her some form of "Happy Birthday" by like 8:00 AM

9
00:37.710 --> 00:38.120
And

10
00:38.120 --> 00:42.380
if I send her a message at, like, 8:05,

11
00:42.380 --> 00:44.600
or 9 o'clock, God forbid,

12
00:44.630 --> 00:47.900
then I am deemed as a *bad child*.

13
00:48.350 --> 00:51.470
I don't know if this is true for you. Um,

14
00:51.530 --> 00:55.010
maybe other Asian kids out there can relate,

15
00:55.040 --> 01:00.040
but my mom has this thing about being wished a "happy birthday" promptly on her

16
01:00.170 --> 01:02.870
birthday. And you know, I always remember her birthday,

17
01:02.870 --> 01:07.790
but I just might remember it at 10 o'clock or, you know, at lunchtime.

18
01:07.820 --> 01:12.080
And I always panic, um, thinking that I've forgotten or missed

19
01:12.110 --> 01:16.580
the crucial eight o'clock in the morning time slot.

20
01:17.180 --> 01:19.130
<v 1>So what did I decide to do?</v>

21
01:19.160 --> 01:19.700
<v 0>Um,</v>

22
01:19.700 --> 01:24.700
I decided to use Python to create a automated way of wishing her a happy

23
01:25.280 --> 01:30.280
birthday at 8:00 AM on the spot or even seven o'clock or five o'clock. That way

24
01:31.640 --> 01:33.830
she'll think that I wake up really early and

25
01:34.310 --> 01:38.300
<v 1>I am working really hard in life. But</v>

26
01:38.630 --> 01:43.610
<v 0>let me demonstrate to you what this app is going to do. This is the birthday</v>

27
01:43.610 --> 01:44.510
wisher demo,

28
01:44.630 --> 01:48.500
and I'm not going to show you the code in my main.py cause that is what

29
01:48.500 --> 01:49.640
you're going to create.

30
01:50.120 --> 01:55.100
But what I've got here is a CSV file called birthdays.csv.

31
01:56.240 --> 02:01.220
Now, here, I'm going to change one of these rows of data to test it.

32
02:01.610 --> 02:05.570
And I'm going to change the month to the current month

33
02:05.600 --> 02:09.890
which is July and the day to the current day, which has 14.

34
02:10.010 --> 02:11.210
So I'll change this

35
02:11.450 --> 02:16.450
which corresponds to this column of data to 7 and then the day to 14.

36
02:18.350 --> 02:21.410
And then I'm going to hit save to save that data.

37
02:21.980 --> 02:24.560
And now I'm going to run this code

38
02:24.920 --> 02:29.920
and what it will do is it'll check against all of these dates inside my

39
02:30.530 --> 02:31.580
birthdays.csv,

40
02:31.910 --> 02:36.910
it'll find that one of these rows of data actually has a month and day that

41
02:36.980 --> 02:38.150
matches today.

42
02:38.540 --> 02:43.540
And it will pick a random letter from one of these text files and replace this

43
02:44.300 --> 02:44.840
name

44
02:44.840 --> 02:49.840
placeholder with the name of the row of data that actually matched today's

45
02:50.450 --> 02:55.010
date. And then it's going to send that as an email to this email.

46
02:55.700 --> 02:58.040
So now if I go ahead and hit run,

47
02:58.870 --> 03:03.610
and once that process is finished, we can go and check our email.

48
03:05.650 --> 03:10.650
And you can see that email show up here with a subject line of Happy Birthday!,

49
03:11.200 --> 03:16.200
and it's replaced the name of the person whose birthday it is right here inside

50
03:18.040 --> 03:21.760
that name placeholder, it sent the rest of the message

51
03:22.120 --> 03:26.560
and this was all done automatically. As you can imagine,

52
03:26.560 --> 03:29.140
if I change this back to a random date,

53
03:29.620 --> 03:32.740
if our code was running in the background every single day

54
03:33.010 --> 03:36.790
checking to see if today's date matched one of these dates,

55
03:36.970 --> 03:40.390
then the day when it actually matches or on their birthday,

56
03:40.660 --> 03:44.500
it's going to pick out their name, insert it into one of these letters randomly,

57
03:44.860 --> 03:46.780
and then send it to them as an email.

58
03:47.260 --> 03:50.710
And the reason why we have three letters is just because so that they don't

59
03:51.310 --> 03:56.050
actually clock onto the fact that it's the same letter being sent every single

60
03:56.050 --> 03:56.883
year.

61
03:57.640 --> 04:01.780
The ethics of this whole project is really up to you to decide. Um,

62
04:01.840 --> 04:05.200
I don't actually do this in reality. Um,

63
04:05.230 --> 04:10.230
I just live with being told I'm a bad child by wishing my mom happy birthday at

64
04:10.480 --> 04:14.290
10:00 AM instead of 8:00 AM. But in terms of Python Programming,

65
04:14.320 --> 04:18.850
this is going to be a really interesting project because it's going to use a lot

66
04:18.850 --> 04:20.470
of the things that you've learned before

67
04:20.470 --> 04:24.970
like pandas to read CSVs or replacing texts,

68
04:25.030 --> 04:28.150
doing mail merge, using built in Python

69
04:28.150 --> 04:32.530
ways of opening and reading files, and also of course what we learned recently

70
04:32.530 --> 04:35.260
which is the datetime module and the smtplib.

71
04:36.460 --> 04:41.020
Now the starting project I've split into three difficulty levels.

72
04:41.380 --> 04:46.180
So depending on how comfortable you feel with the things that you've learned in

73
04:46.180 --> 04:47.890
all of these 32 days,

74
04:48.070 --> 04:52.660
you can pick which level of starting project you want to use.

75
04:53.200 --> 04:57.430
Obviously, if you go for the extra hard starting project,

76
04:57.730 --> 04:59.680
it's not going to have a lot of hints in there.

77
04:59.710 --> 05:03.190
It's going to tell you generally what the program needs to do

78
05:03.310 --> 05:08.020
and it's your job to figure out how to actually implement it using maybe a

79
05:08.020 --> 05:12.100
Google search or Stack Overflow or looking through some of the path lessons.

80
05:12.250 --> 05:15.340
This is going to be the extra hard version.

81
05:15.790 --> 05:19.240
And then there's the hard version with some hints, but not a lot.

82
05:19.630 --> 05:23.650
And there's the normal version where I've put in a lot more hints that will make

83
05:23.650 --> 05:26.560
it a little bit easier for you to write out all the code.

84
05:27.250 --> 05:31.600
So depending on how confident you feel, head over to the course resources,

85
05:31.960 --> 05:36.010
pic the difficulty level for your starting project

86
05:36.700 --> 05:39.190
and then go ahead and try to complete this project.