1
00:00:00,420 --> 00:00:05,420
Now it's finally time to put all of our skills to use by creating our automated

2
00:00:05,850 --> 00:00:06,870
birthday wisher

3
00:00:07,200 --> 00:00:10,920
which is going to send our family or friends

4
00:00:11,340 --> 00:00:15,660
a "Happy Birthday" email on their birthday automatically.

5
00:00:15,960 --> 00:00:19,980
Now the idea for this project actually came from my mum. Well,

6
00:00:20,040 --> 00:00:20,970
inadvertently.

7
00:00:21,360 --> 00:00:25,350
Now I love my mom to death and she is my biggest source of motivation and

8
00:00:25,380 --> 00:00:28,590
inspiration. But on her birthday,

9
00:00:28,830 --> 00:00:33,830
she always expects me to send her some form of "Happy Birthday" by like 8:00 AM

10
00:00:37,710 --> 00:00:38,120
And

11
00:00:38,120 --> 00:00:42,380
if I send her a message at, like, 8:05,

12
00:00:42,380 --> 00:00:44,600
or 9 o'clock, God forbid,

13
00:00:44,630 --> 00:00:47,900
then I am deemed as a *bad child*.

14
00:00:48,350 --> 00:00:51,470
I don't know if this is true for you. Um,

15
00:00:51,530 --> 00:00:55,010
maybe other Asian kids out there can relate,

16
00:00:55,040 --> 00:01:00,040
but my mom has this thing about being wished a "happy birthday" promptly on her

17
00:01:00,170 --> 00:01:02,870
birthday. And you know, I always remember her birthday,

18
00:01:02,870 --> 00:01:07,790
but I just might remember it at 10 o'clock or, you know, at lunchtime.

19
00:01:07,820 --> 00:01:12,080
And I always panic, um, thinking that I've forgotten or missed

20
00:01:12,110 --> 00:01:16,580
the crucial eight o'clock in the morning time slot.

21
00:01:17,180 --> 00:01:19,130
So what did I decide to do?

22
00:01:19,160 --> 00:01:19,700
Um,

23
00:01:19,700 --> 00:01:24,700
I decided to use Python to create a automated way of wishing her a happy

24
00:01:25,280 --> 00:01:30,280
birthday at 8:00 AM on the spot or even seven o'clock or five o'clock. That way

25
00:01:31,640 --> 00:01:33,830
she'll think that I wake up really early and

26
00:01:34,310 --> 00:01:38,300
I am working really hard in life. But

27
00:01:38,630 --> 00:01:43,610
let me demonstrate to you what this app is going to do. This is the birthday

28
00:01:43,610 --> 00:01:44,510
wisher demo,

29
00:01:44,630 --> 00:01:48,500
and I'm not going to show you the code in my main.py cause that is what

30
00:01:48,500 --> 00:01:49,640
you're going to create.

31
00:01:50,120 --> 00:01:55,100
But what I've got here is a CSV file called birthdays.csv.

32
00:01:56,240 --> 00:02:01,220
Now, here, I'm going to change one of these rows of data to test it.

33
00:02:01,610 --> 00:02:05,570
And I'm going to change the month to the current month

34
00:02:05,600 --> 00:02:09,889
which is July and the day to the current day, which has 14.

35
00:02:10,009 --> 00:02:11,210
So I'll change this

36
00:02:11,450 --> 00:02:16,450
which corresponds to this column of data to 7 and then the day to 14.

37
00:02:18,350 --> 00:02:21,410
And then I'm going to hit save to save that data.

38
00:02:21,980 --> 00:02:24,560
And now I'm going to run this code

39
00:02:24,920 --> 00:02:29,920
and what it will do is it'll check against all of these dates inside my

40
00:02:30,530 --> 00:02:31,580
birthdays.csv,

41
00:02:31,910 --> 00:02:36,910
it'll find that one of these rows of data actually has a month and day that

42
00:02:36,980 --> 00:02:38,150
matches today.

43
00:02:38,540 --> 00:02:43,540
And it will pick a random letter from one of these text files and replace this

44
00:02:44,300 --> 00:02:44,840
name

45
00:02:44,840 --> 00:02:49,840
placeholder with the name of the row of data that actually matched today's

46
00:02:50,450 --> 00:02:55,010
date. And then it's going to send that as an email to this email.

47
00:02:55,700 --> 00:02:58,040
So now if I go ahead and hit run,

48
00:02:58,870 --> 00:03:03,610
and once that process is finished, we can go and check our email.

49
00:03:05,650 --> 00:03:10,650
And you can see that email show up here with a subject line of Happy Birthday!,

50
00:03:11,200 --> 00:03:16,200
and it's replaced the name of the person whose birthday it is right here inside

51
00:03:18,040 --> 00:03:21,760
that name placeholder, it sent the rest of the message

52
00:03:22,120 --> 00:03:26,560
and this was all done automatically. As you can imagine,

53
00:03:26,560 --> 00:03:29,140
if I change this back to a random date,

54
00:03:29,620 --> 00:03:32,740
if our code was running in the background every single day

55
00:03:33,010 --> 00:03:36,790
checking to see if today's date matched one of these dates,

56
00:03:36,970 --> 00:03:40,390
then the day when it actually matches or on their birthday,

57
00:03:40,660 --> 00:03:44,500
it's going to pick out their name, insert it into one of these letters randomly,

58
00:03:44,860 --> 00:03:46,780
and then send it to them as an email.

59
00:03:47,260 --> 00:03:50,710
And the reason why we have three letters is just because so that they don't

60
00:03:51,310 --> 00:03:56,050
actually clock onto the fact that it's the same letter being sent every single

61
00:03:56,050 --> 00:03:56,883
year.

62
00:03:57,640 --> 00:04:01,780
The ethics of this whole project is really up to you to decide. Um,

63
00:04:01,840 --> 00:04:05,200
I don't actually do this in reality. Um,

64
00:04:05,230 --> 00:04:10,230
I just live with being told I'm a bad child by wishing my mom happy birthday at

65
00:04:10,480 --> 00:04:14,290
10:00 AM instead of 8:00 AM. But in terms of Python Programming,

66
00:04:14,320 --> 00:04:18,850
this is going to be a really interesting project because it's going to use a lot

67
00:04:18,850 --> 00:04:20,470
of the things that you've learned before

68
00:04:20,470 --> 00:04:24,970
like pandas to read CSVs or replacing texts,

69
00:04:25,030 --> 00:04:28,150
doing mail merge, using built in Python

70
00:04:28,150 --> 00:04:32,530
ways of opening and reading files, and also of course what we learned recently

71
00:04:32,530 --> 00:04:35,260
which is the datetime module and the smtplib.

72
00:04:36,460 --> 00:04:41,020
Now the starting project I've split into three difficulty levels.

73
00:04:41,380 --> 00:04:46,180
So depending on how comfortable you feel with the things that you've learned in

74
00:04:46,180 --> 00:04:47,890
all of these 32 days,

75
00:04:48,070 --> 00:04:52,660
you can pick which level of starting project you want to use.

76
00:04:53,200 --> 00:04:57,430
Obviously, if you go for the extra hard starting project,

77
00:04:57,730 --> 00:04:59,680
it's not going to have a lot of hints in there.

78
00:04:59,710 --> 00:05:03,190
It's going to tell you generally what the program needs to do

79
00:05:03,310 --> 00:05:08,020
and it's your job to figure out how to actually implement it using maybe a

80
00:05:08,020 --> 00:05:12,100
Google search or Stack Overflow or looking through some of the path lessons.

81
00:05:12,250 --> 00:05:15,340
This is going to be the extra hard version.

82
00:05:15,790 --> 00:05:19,240
And then there's the hard version with some hints, but not a lot.

83
00:05:19,630 --> 00:05:23,650
And there's the normal version where I've put in a lot more hints that will make

84
00:05:23,650 --> 00:05:26,560
it a little bit easier for you to write out all the code.

85
00:05:27,250 --> 00:05:31,600
So depending on how confident you feel, head over to the course resources,

86
00:05:31,960 --> 00:05:36,010
pic the difficulty level for your starting project

87
00:05:36,700 --> 00:05:39,190
and then go ahead and try to complete this project.

