Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,330 --> 00:00:06,690
All right, guys, it's time for the final project of today. So the program that you're going to be
2
00:00:06,690 --> 00:00:12,360
building looks a little bit like this. And you can check it out if you head over to this link, either
3
00:00:12,360 --> 00:00:18,320
by typing it in or heading to the resources page and clicking on the corresponding link.
4
00:00:18,840 --> 00:00:27,330
But essentially, it's a band name generator. And it asks you for a city that you grew up in and the name of your
5
00:00:27,330 --> 00:00:27,770
pet.
6
00:00:28,080 --> 00:00:32,080
And then it combines those together and gives you the name of your band.
7
00:00:32,700 --> 00:00:34,290
There's a couple of things to note here.
8
00:00:34,300 --> 00:00:41,980
Firstly is notice when this input got triggered, the cursor actually showed up on a new line.
9
00:00:42,000 --> 00:00:46,010
So if I run this again, you can see it says "What's the name of city you grew up in?"
10
00:00:46,020 --> 00:00:48,600
And then the cursor is on the next line.
11
00:00:49,380 --> 00:00:54,540
And what I want you to do is to go ahead and head over to this starting project.
12
00:00:55,050 --> 00:00:56,490
So this is the URL
13
00:00:56,490 --> 00:00:59,490
and it's also, of course, in the course resources.
14
00:00:59,910 --> 00:01:05,080
And once you head over here, you can fork this code and complete your own version.
15
00:01:05,430 --> 00:01:08,580
So there's a couple of steps in here as hints.
16
00:01:09,030 --> 00:01:14,010
If you don't want to see these and you just want to go by the end project, you can also just delete
17
00:01:14,010 --> 00:01:14,640
all of these.
18
00:01:15,180 --> 00:01:21,270
But the important thing is once you've completed this project, it should work exactly the same as the
19
00:01:21,270 --> 00:01:22,550
one that you see here.
20
00:01:23,190 --> 00:01:28,230
And in order to do this, you're going to have to apply everything that you learned today, including
21
00:01:28,230 --> 00:01:34,960
printing inputs, variables, new lines, string manipulation, debugging and a whole lot more.
22
00:01:35,310 --> 00:01:41,790
So this is a time to grab yourself a cup of tea 🍵 or coffee ☕️, pause the video and tackle this final project.
23
00:01:46,510 --> 00:01:52,270
All right, guys, I hope you gave that a go and you were able to complete it. If you want to see how
24
00:01:52,270 --> 00:01:57,970
I've implemented it or if you want to just check to see if you have any errors or if there's something
25
00:01:57,970 --> 00:02:02,520
that you're unsure about, then continue watching and I'll go through the solution with you.
26
00:02:03,920 --> 00:02:09,800
The first step is to create a greeting for your program, in our case, it says "Welcome to the band
27
00:02:09,800 --> 00:02:10,720
name generator."
28
00:02:11,090 --> 00:02:13,240
So that's exactly what I'm going to create.
29
00:02:13,490 --> 00:02:16,720
And we print these messages using the print function.
30
00:02:17,210 --> 00:02:22,610
So I'm going to say "Welcome to the band name generator."
31
00:02:24,110 --> 00:02:27,560
And this when I run, it will just print that message.
32
00:02:29,690 --> 00:02:35,330
Now, the next step is to ask the user for the city that they grew up in. So in order to get some input
33
00:02:35,330 --> 00:02:38,540
from the user will need, of course, the input function.
34
00:02:38,870 --> 00:02:46,820
And we're going to ask them using the prompt, which goes inside the parentheses: "Which city did you
35
00:02:46,820 --> 00:02:49,040
grow up in?"
36
00:02:49,610 --> 00:02:56,770
So now when I hit run, it's going to ask me for the city that I grew up in and I'm able to add a reply
37
00:02:57,020 --> 00:02:57,620
like so.
38
00:02:58,850 --> 00:03:06,080
Now, that data is just going to be lost to thin air unless I capture it and I give it a name, so I'm
39
00:03:06,080 --> 00:03:09,920
going to have to create a variable to hold onto the data that the user inputted.
40
00:03:10,280 --> 00:03:16,190
So we'll just call that "city" and then add the equal sign (=) to assign whatever it is that the user typed
41
00:03:16,190 --> 00:03:18,200
in to this variable name.
42
00:03:19,010 --> 00:03:27,680
And now I have access to the city variable and I can print it or use it later on if I want to, like so.
43
00:03:30,770 --> 00:03:35,260
Now, the next step is to ask the user for the name of a pet.
44
00:03:35,390 --> 00:03:41,840
So we'll call that variable "pet" and we'll assign it the value that the user inputs for:
45
00:03:42,170 --> 00:03:45,140
"What is the name of a pet?"
46
00:03:46,810 --> 00:03:52,030
Now, step 4 is to combine the name of the city and the pet and show them their band name.
47
00:03:52,060 --> 00:03:55,860
Now, there's quite a few ways of doing this, especially if you look around on the Internet.
48
00:03:56,230 --> 00:04:00,690
But the way that you learn in today's lessons is using string concatenation.
49
00:04:01,120 --> 00:04:02,150
So we're going to do that.
50
00:04:02,200 --> 00:04:07,540
So we're going to use a print statement and tell them "Your band name could be..."
51
00:04:08,500 --> 00:04:17,410
And then we're going to add the name of the city and then add a space and then add the name of their
52
00:04:17,410 --> 00:04:17,800
pet.
53
00:04:18,610 --> 00:04:20,770
So now when we run our code
54
00:04:20,770 --> 00:04:29,590
it will ask us for the name of their city and then the name of a pet, and then it should combine those
55
00:04:29,590 --> 00:04:31,960
together and show us the name of our band.
56
00:04:32,560 --> 00:04:39,180
Now, the final step is that the input cursor should show on a new line like this.
57
00:04:39,190 --> 00:04:40,650
So here's the cursor.
58
00:04:40,660 --> 00:04:42,220
But here's the input.
59
00:04:42,550 --> 00:04:48,700
Just so that you get a bit of space and you're not typing it in directly after the prompt here like
60
00:04:48,700 --> 00:04:49,360
what we have.
61
00:04:49,900 --> 00:04:51,160
So how do we do that?
62
00:04:51,430 --> 00:04:57,610
Well, you learned about modifying strings by creating a new line using the \n.
63
00:04:58,150 --> 00:05:03,220
And we can add that both to the end of the city input and the pet input.
64
00:05:03,530 --> 00:05:10,930
And now when we run our code, you'll see that the cursor now shows up on the next line and our program
65
00:05:10,930 --> 00:05:12,130
looks a lot better.
66
00:05:13,780 --> 00:05:15,030
So there you have it.
67
00:05:15,310 --> 00:05:22,030
This is how you solve this boss challenge and this is how you create the band name generator project.
68
00:05:22,480 --> 00:05:28,480
So I hope you had fun with me today, learning Python and a lot of the fundamentals of Python.
69
00:05:28,930 --> 00:05:36,280
And tomorrow I've got another jam packed module of really awesome tutorials and challenges and projects
70
00:05:36,280 --> 00:05:37,570
for you to sink your teeth into!
71
00:05:38,080 --> 00:05:42,970
I'm looking forward to seeing you tomorrow, so I have a rest now and let your brain 🧠 work on the things
72
00:05:42,970 --> 00:05:44,200
that you learned while you sleep.
73
00:05:44,620 --> 00:05:46,750
And I'll see you here bright and early.
74
00:05:46,810 --> 00:05:48,150
Good night and see you tomorrow.
8030
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.