Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,690 --> 00:00:06,900
Throughout this course, we'll be getting you involved in a lot of these interactive coding exercises.
2
00:00:06,900 --> 00:00:11,820
And the idea is that you're not just sitting here watching me talk, that you're actually putting everything
3
00:00:11,820 --> 00:00:13,490
you're learning into practice.
4
00:00:13,500 --> 00:00:15,840
That way it actually becomes your own.
5
00:00:15,900 --> 00:00:21,810
It's a great because we can give you instructions and show you what should happen if you write the correct
6
00:00:21,810 --> 00:00:27,840
code, what it needs to do, and you'll be able to write your code as well as see it run in the console.
7
00:00:28,110 --> 00:00:33,090
Once you're done with your code, you'll be able to submit it and see the tests run.
8
00:00:33,420 --> 00:00:37,620
And if you've written the code correctly, then all of the tests will pass.
9
00:00:38,040 --> 00:00:40,890
If your code isn't doing what it's supposed to.
10
00:00:40,920 --> 00:00:45,600
Then when you click submit, you'll get feedback and you'll see what it's meant to do and what your
11
00:00:45,600 --> 00:00:47,070
code is actually doing.
12
00:00:47,070 --> 00:00:50,490
So you'll be able to use that to figure out what's wrong and fix your code.
13
00:00:50,640 --> 00:00:55,650
And it's through a lot of these exercises that you're going to level up and you're going to become a
14
00:00:55,650 --> 00:00:56,580
better coder.
15
00:00:56,790 --> 00:01:02,280
Now, in order for you to get set up on our coding rooms, we're going to have to get you signed up
16
00:01:02,280 --> 00:01:04,500
and registered with our course.
17
00:01:04,590 --> 00:01:10,560
So in order to do this, I want you to first head over to codingrooms.com and then sign up for
18
00:01:10,560 --> 00:01:12,180
a student account.
19
00:01:12,540 --> 00:01:18,780
Now this is completely free and all you have to do is just do click, sign up, putting your email and
20
00:01:18,780 --> 00:01:24,720
password, and then you can choose student for this question Who are you?
21
00:01:24,960 --> 00:01:31,740
And then putting your first name and last name and click "Finish". Next,
22
00:01:31,740 --> 00:01:36,540
in order to get hold of the Joining Link, I want you to go to the course resources for the current
23
00:01:36,540 --> 00:01:37,950
lesson on Udemy.
24
00:01:37,950 --> 00:01:43,530
So the lesson is "[Interactive Coding Exercise] Printing", and then I want you to click on the dropdown
25
00:01:43,530 --> 00:01:48,630
list and you should see step one sign up to coding rooms, which you should have already done.
26
00:01:48,630 --> 00:01:51,780
And then step two is join our coding room.
27
00:01:51,780 --> 00:01:53,520
So I want you to click on that link.
28
00:01:53,760 --> 00:01:59,640
And once you've clicked on that link, then it should automatically enroll you into our 100 days of
29
00:01:59,640 --> 00:02:06,450
code, the Complete Python Pro Bootcamp, and you should now be able to see every day's corresponding
30
00:02:06,450 --> 00:02:08,250
interactive coding exercises.
31
00:02:08,250 --> 00:02:14,430
So for example, on day one there are four exercises and they are named exactly the same as what you
32
00:02:14,430 --> 00:02:15,690
see in Udemy.
33
00:02:15,690 --> 00:02:21,720
So this is interactive coding exercise one which is printing, debugging, practice, input, function
34
00:02:21,720 --> 00:02:27,180
and variables and you see all the same ones over here that you'll be able to attempt.
35
00:02:27,900 --> 00:02:33,090
Now the next time when you log in, all you have to do is just go into your courses and you should see
36
00:02:33,090 --> 00:02:38,880
the interactive coding exercises for the 100 days of code, and you will be able to continue where you
37
00:02:38,880 --> 00:02:39,630
left off.
38
00:02:40,020 --> 00:02:42,960
Now let's get started with the first exercise.
39
00:02:42,960 --> 00:02:45,270
That's the objective of this lesson.
40
00:02:45,450 --> 00:02:48,300
So we're going to go into day one and it might be collapsed.
41
00:02:48,300 --> 00:02:53,760
If so, just go ahead and expand it and then click on Exercise 1 - Printing.
42
00:02:53,850 --> 00:02:59,640
And here you see the instructions for what you need to do in order to complete this coding exercise.
43
00:02:59,910 --> 00:03:06,360
Now, I want you to go ahead and click on Open Assignment Workspace, and here you'll be able to see
44
00:03:06,360 --> 00:03:09,600
the instructions on one side of the pane.
45
00:03:09,600 --> 00:03:13,110
You'll be able to have your main.py, which is where you write your code.
46
00:03:13,110 --> 00:03:16,530
So all the lines below here, you can just type your code out.
47
00:03:16,530 --> 00:03:23,610
And then once you're done writing your code, I want you to test it by running your code.
48
00:03:23,610 --> 00:03:30,720
So hitting this run button and you'll see the result of your code being run in the console down here.
49
00:03:30,960 --> 00:03:36,030
Now once you think you've completed the coding exercise according to all the instructions over here,
50
00:03:36,060 --> 00:03:41,880
I want you to go ahead and test your code and you can test your code by simply hitting submit.
51
00:03:42,480 --> 00:03:47,250
Now, don't worry about all of this where it says this submission will count towards your grade for
52
00:03:47,250 --> 00:03:47,880
the assignment.
53
00:03:47,880 --> 00:03:50,400
There are no grades, there's no time limits.
54
00:03:50,400 --> 00:03:52,920
Nobody is going to check what you've done.
55
00:03:52,920 --> 00:03:59,010
It's all for the benefit of your learning so you can submit your code as many times as you like.
56
00:03:59,220 --> 00:04:04,710
So once you hit submit, it's going to run the automated test that we've set up behind the scenes,
57
00:04:04,710 --> 00:04:09,270
and it's going to check to make sure that your code is doing what it's supposed to do.
58
00:04:09,810 --> 00:04:17,579
So, for example, in this case, my tests have not passed because there's a cross here and note that
59
00:04:17,579 --> 00:04:21,570
sometimes there'll be more than one test, so you can scroll down and see the other ones.
60
00:04:21,810 --> 00:04:27,690
And the reason why I didn't pass, as they've shown here, is this is my actual output.
61
00:04:27,690 --> 00:04:32,760
This is what my code did and this is what the expected output is supposed to be.
62
00:04:32,760 --> 00:04:34,740
And there's a whole bunch of differences.
63
00:04:34,740 --> 00:04:39,870
This does not look like this, so then we have to go and fix it.
64
00:04:39,870 --> 00:04:43,800
And I've left some feedback in some of the lessons to help you in case you get stuck.
65
00:04:43,800 --> 00:04:46,440
But also there are hints in some of the instructions.
66
00:04:46,440 --> 00:04:52,410
So just make sure that you read everything now if you want to, or if you get really, really stuck,
67
00:04:52,410 --> 00:04:54,810
you can take a look at the solution.
68
00:04:54,810 --> 00:04:59,670
Now, I don't recommend looking at the solution code unless you're actually just checking to make sure
69
00:04:59,670 --> 00:04:59,940
that.
70
00:05:00,030 --> 00:05:05,400
Something hasn't gone majorly wrong or you're not completely stuck, or just for whatever reason, I
71
00:05:05,400 --> 00:05:11,190
really, really want you to persevere and try your best to actually write the code yourself and to solve
72
00:05:11,190 --> 00:05:14,520
the issues and figure out how to make all the tests pass.
73
00:05:14,760 --> 00:05:19,380
But if you need to look at the solution, they are available on replit.
74
00:05:19,380 --> 00:05:24,900
So just click on this link and it'll take you to the solution page in order to see the files.
75
00:05:24,900 --> 00:05:28,440
You can either fork the repl as you have done before.
76
00:05:28,470 --> 00:05:36,210
You'll get a copy of this solution file or what I think is much simpler is simply click on show files
77
00:05:36,210 --> 00:05:42,840
and then click on this main.py file and then you will see the solution code on this page without
78
00:05:42,840 --> 00:05:45,990
having to fork a copy of this repl.
79
00:05:45,990 --> 00:05:47,850
But you can do it any number of ways.
80
00:05:47,850 --> 00:05:50,700
Whichever way suits you best is fine.
81
00:05:50,700 --> 00:05:56,820
Now, once you have written your code correctly, you should be able to see all the tests pass and by
82
00:05:56,820 --> 00:06:01,200
passing it means that there's a little tick along each of these.
83
00:06:01,200 --> 00:06:04,320
And usually in this one there's only one test and this is passed.
84
00:06:04,320 --> 00:06:06,120
So you get a score of 100%.
85
00:06:06,300 --> 00:06:12,780
And the actual output that your code has created in the console now looks exactly the same as expected.
86
00:06:12,780 --> 00:06:18,900
So you are now done and you can go back to your other assignments and you can continue.
87
00:06:19,200 --> 00:06:25,650
So this is a really simple interface and we've switched to this from replit because replit had actually
88
00:06:25,650 --> 00:06:30,540
disabled their classroom technology, which looks basically exactly the same as this.
89
00:06:30,540 --> 00:06:35,100
And we wanted to provide you the best learning experience possible.
90
00:06:35,100 --> 00:06:40,650
So we've switched over to coding rooms and you should be able to sign up and get started without any
91
00:06:40,650 --> 00:06:41,220
issue.
92
00:06:41,250 --> 00:06:47,880
Now remember at the end of the lesson, I will go through the solution with you step by step explaining
93
00:06:47,880 --> 00:06:48,990
the solution as well.
94
00:06:48,990 --> 00:06:53,010
So if you get stuck, don't worry, I'm here for you every step of the way.
95
00:06:53,010 --> 00:06:58,740
But now it's time for you to pause the video and make sure that you've signed up for coding rooms,
96
00:06:58,740 --> 00:07:04,890
already registered for a student account, and then click on the link in step two in the course resources
97
00:07:04,890 --> 00:07:12,330
and sign up for our course and then go over to the first exercise printing and give it a go.
98
00:07:12,360 --> 00:07:13,770
All right, pause the video now.
99
00:07:14,040 --> 00:07:14,520
All right.
100
00:07:14,520 --> 00:07:15,750
How did you get on?
101
00:07:16,020 --> 00:07:20,910
I really hope you gave this a good go because it's in these moments where you're going to be learning
102
00:07:20,910 --> 00:07:21,600
the code.
103
00:07:21,630 --> 00:07:26,280
Unfortunately, no amount of listening to me talk is actually going to give you these skills.
104
00:07:26,280 --> 00:07:31,740
It's only when you actually try it out and get the computer to do the thing that you wanted to do.
105
00:07:31,740 --> 00:07:35,850
That's when you become the master of the computer, also known as a programmer.
106
00:07:36,090 --> 00:07:38,820
So in this case, the instructions are pretty simple.
107
00:07:38,820 --> 00:07:44,910
We have to use what we learn about the print statement to output these three lines and notice how in
108
00:07:44,910 --> 00:07:48,570
this gif the lines are printing out in separate lines.
109
00:07:48,750 --> 00:07:51,660
This one gets printed, then this one, then this one.
110
00:07:51,660 --> 00:07:56,790
But because it happens so fast, it seems like it as if they're getting printed as a single block.
111
00:07:56,940 --> 00:07:59,790
So we're told to write our code below this line.
112
00:08:00,390 --> 00:08:06,180
And we know that in order to print something, we use the print function with a set of parentheses,
113
00:08:06,180 --> 00:08:10,830
and inside the parentheses is where we tell it what we want it to print.
114
00:08:10,830 --> 00:08:20,430
So in the first instance, it's day one space, then it's now it's really easy to make spelling mistakes.
115
00:08:20,430 --> 00:08:26,970
But I really encourage you to actually type out anything that you put into your code rather than just
116
00:08:26,970 --> 00:08:29,160
simply copying and pasting it.
117
00:08:29,160 --> 00:08:31,680
Now, of course, it works exactly the same way.
118
00:08:31,680 --> 00:08:39,360
I could just copy and paste the code in here, but it's often in these cases where you make mistakes,
119
00:08:39,360 --> 00:08:45,690
like for example, forgetting to add the double quotes around the text that you want to print, I really
120
00:08:45,690 --> 00:08:50,490
recommend just typing out the code for practice whenever you're doing these code challenges.
121
00:08:51,480 --> 00:08:56,010
Now, the last line that we want to print is a little bit complicated.
122
00:08:56,040 --> 00:09:02,130
It's almost like print inception, because what we want to print is this function.
123
00:09:02,130 --> 00:09:09,210
This is how we write our function, and that has to go inside here, inside a set of double quotes.
124
00:09:09,210 --> 00:09:13,380
So let's open up a double quotes and then write our print statement.
125
00:09:13,530 --> 00:09:18,060
And in this case, I'm actually using a single quote.
126
00:09:18,060 --> 00:09:21,750
And I'll tell you just in a little moment why that is.
127
00:09:22,320 --> 00:09:24,030
So let's add that single quote.
128
00:09:24,030 --> 00:09:26,760
And finally, the closing parentheses.
129
00:09:26,760 --> 00:09:31,560
This now is the entire code that you would need to be able to print something out.
130
00:09:31,740 --> 00:09:37,080
And when I go ahead and click Run, you can see that the output looks exactly the same as what we've
131
00:09:37,080 --> 00:09:38,310
got here in the gif.
132
00:09:38,310 --> 00:09:39,990
This is what we want.
133
00:09:39,990 --> 00:09:46,830
And when I click submit you'll see that my tests all pass and I can now submit my assignment and I've
134
00:09:46,830 --> 00:09:48,960
now completed the coding challenge.
135
00:09:49,290 --> 00:09:55,770
Now coming back to this single quote, why is it that I've got a single quote here rather than a double
136
00:09:55,770 --> 00:09:58,380
quote, which is what we've been using all this time?
137
00:09:58,440 --> 00:09:59,340
Well, because in.
138
00:09:59,530 --> 00:10:00,070
Python.
139
00:10:00,070 --> 00:10:05,260
It doesn't actually care whether if you enclose the strings.
140
00:10:05,260 --> 00:10:13,470
So these pieces of text are not to be interpreted as code inside single quotes or inside double quotes.
141
00:10:13,480 --> 00:10:16,090
It is identical to the computer.
142
00:10:16,120 --> 00:10:18,490
This honey badger literally doesn't care.
143
00:10:18,820 --> 00:10:27,130
But if you had a set of double quotes and then you wanted another set of double quotes inside the double
144
00:10:27,130 --> 00:10:27,790
quotes.
145
00:10:27,790 --> 00:10:34,420
So, for example, if I replace this with double quotes, you'll see that already the syntax highlighting
146
00:10:34,420 --> 00:10:36,070
is already screaming out to us.
147
00:10:36,070 --> 00:10:44,230
There's something that's not quite right here because the colors are not the same as here, where the
148
00:10:44,230 --> 00:10:51,160
print function is in a particular color, the parentheses are in a particular color, and the text that
149
00:10:51,160 --> 00:10:54,820
is to be printed in, it's in a yet another different color.
150
00:10:54,850 --> 00:10:59,410
In this case, it looks all jumbled up and we're getting some errors here.
151
00:10:59,740 --> 00:11:03,490
So now if I hit run, you'll get syntax errors.
152
00:11:04,180 --> 00:11:12,910
And the problem here is, of course, this is of course, our code things at the end of this string
153
00:11:12,910 --> 00:11:13,840
is here.
154
00:11:13,990 --> 00:11:17,680
And so it doesn't know what on earth is going on afterwards.
155
00:11:18,220 --> 00:11:26,950
And instead it's seeing this as a string, this as a string, and this is being interpreted as code.
156
00:11:27,670 --> 00:11:34,330
So when we want to use some double quotes inside another set of double quotes, commonly you'll see
157
00:11:34,330 --> 00:11:38,050
people switch to single quotes instead.
158
00:11:38,200 --> 00:11:45,610
So you could, for example, write the print statement like so and use double quotes if you want to
159
00:11:45,610 --> 00:11:46,750
print those out.
160
00:11:46,990 --> 00:11:52,840
Or you can do it the other way, which is what I had before, where we use our double quotes on the
161
00:11:52,840 --> 00:11:55,150
outside and single quotes on the inside.
162
00:11:55,270 --> 00:11:58,690
So have a play around with that, if that's at all confusing.
163
00:11:58,690 --> 00:12:03,310
But once you've tried it a few times and switched it around a few times, it should become clear what
164
00:12:03,310 --> 00:12:04,450
it's actually doing.
165
00:12:04,930 --> 00:12:07,600
How did you get on with this challenge?
166
00:12:07,660 --> 00:12:11,830
If you ever need to see the solution, it's always down here as a link.
167
00:12:12,340 --> 00:12:14,200
So I hope you enjoy this challenge.
168
00:12:14,200 --> 00:12:19,240
In the next lesson, we're going to get back to learning about Python and we're going to learn about
169
00:12:19,240 --> 00:12:23,650
strings and string manipulation for all of that and more.
170
00:12:23,680 --> 00:12:24,370
I'll see you there.
18267
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.