WEBVTT

00:02.300 --> 00:06.950
Hello and welcome back to our costs on the session we are going a bit deeper into the most important

00:06.950 --> 00:10.250
modes and functionalities of tubular notebooks.

00:10.250 --> 00:16.520
Also we will have a look at the most frequently used keyboard shortcuts that makes actually our life

00:16.550 --> 00:17.960
easier and more efficient.

00:17.960 --> 00:23.820
However as with all new things them the best and fastest way to get the familiar and comfortable stupid

00:23.870 --> 00:27.910
notebooks is of course by practice and coding on your own.

00:27.950 --> 00:33.340
You will see after a few hours of working with stupider that it's getting more and more intuitive.

00:33.380 --> 00:37.820
All right so nevertheless I want to give you some good hands and head for the start.

00:37.820 --> 00:41.690
So let's open a Jupiter notebook with the navigator

01:02.230 --> 01:09.760
and we want to create a brand new Jupiter notebook and we could call it test to

01:13.420 --> 01:15.280
and let's start with an easy code.

01:15.280 --> 01:21.440
So let's calculate one plus one and we run the so by pressing shift.

01:21.450 --> 01:23.450
And so now we are on the next line.

01:24.210 --> 01:33.190
And here we could calculate the four plus four and also execute the cell by pressing shift enter and

01:33.190 --> 01:39.360
in the last session I said that when we are here in this cell we can see here that the setting is the

01:39.580 --> 01:39.930
code.

01:39.930 --> 01:47.430
So if we stop writing we are actually writing Python code and we can change this to mark down.

01:47.470 --> 01:51.430
So now the setting is marked down and this is simply a text editor.

01:51.430 --> 01:58.040
So if you now stop writing here and run the cell we are getting a text actually.

01:58.210 --> 02:02.360
And now beyond in your cell and you can see it by default the setting is to code.

02:02.360 --> 02:08.960
But we can of course changed again to mark down and what we can also do we can make it I could kill

02:08.960 --> 02:17.120
a heading so by starting a line with them the hash key and a space and then row by writing a text we

02:17.120 --> 02:18.740
can create a header with them.

02:18.740 --> 02:19.070
Yeah.

02:19.070 --> 02:20.410
Lots of fun size.

02:20.510 --> 02:25.640
So let's run here and that's maybe let's name here.

02:25.940 --> 02:35.090
Oh I had a calculator and then now in the next slide we want to create a sub header and that's called

02:35.090 --> 02:37.310
the subheading let's say edition

02:39.960 --> 02:48.950
first of all we have to make the setting to mark down and then we press hash key and make a space.

02:48.950 --> 02:51.100
So now we have the same hierarchy.

02:51.110 --> 02:58.700
So the font size is identical and if we add here another hash clear the font size is getting smaller.

02:58.730 --> 03:01.760
So this could be a lower hierarchical heading.

03:01.760 --> 03:05.210
And by adding more and more hash keys it's getting smaller.

03:05.960 --> 03:13.540
So let's take two hash keys and run the server and now we can also move our heading to the top of our

03:13.600 --> 03:20.330
put a notebook by pressing here move selected s up so we can move it here up.

03:20.350 --> 03:29.180
Also the addition Jupiter notebook has two modes so that's the added mode and the command mode and the

03:29.180 --> 03:31.700
edit mode as indicated by a green cell board.

03:31.730 --> 03:37.650
So if we go into the cell here we click into the center then we see here a green salad border.

03:37.970 --> 03:40.030
And when I say is in the edit mode.

03:40.100 --> 03:45.010
Yeah we can type into the cell and type our Python code our text.

03:45.050 --> 03:53.570
So here we can change from one plus one to one plus twelve let's say and then we can run the cell and

03:53.570 --> 03:54.280
we get 13.

03:54.280 --> 04:00.860
So we changed the content of the cell in the edit mode and the second mode the command mode as indicated

04:00.860 --> 04:09.180
by a grace cell border and the bluer margin here and when we are in a command mode we are able to edit

04:09.240 --> 04:13.410
the notebook as a whole but we cannot type in to the individual cell.

04:13.830 --> 04:21.510
So for example in command mode we can add and delete cells and they make more changes to the whole notebook

04:22.100 --> 04:25.790
and there are two ways from switching from the command mode to the edit mode.

04:25.800 --> 04:34.390
So either you go with our mouse cars or into the cell so we can see changes from blue to green and then

04:34.390 --> 04:37.350
we can go back to command mode by clicking here.

04:37.360 --> 04:44.570
Outside the cell so you can see here we are blue again in the command mode and there are also keyboard

04:44.570 --> 04:46.300
shortcuts for it.

04:46.400 --> 04:52.590
So we are now in the command mode and if we click enter we are getting to the edit mode.

04:52.610 --> 04:58.420
And when we are in the edit mode and press the escape key then we are coming back to the command mode.

04:58.460 --> 05:00.170
So what can we do in the command mode.

05:00.170 --> 05:10.070
For example we can add a cell above our cell so we can now press the key a for inserting a cell above.

05:10.430 --> 05:12.790
And now here we have inserted a cell above.

05:13.020 --> 05:14.630
And let's go back to our cell here.

05:14.630 --> 05:16.880
So now we are in edit mode.

05:16.940 --> 05:25.020
We press escaped to go to the command mode and then we press and the big key to insert a cell below.

05:25.410 --> 05:31.170
You can see we have now inserted a cell below and let us go down to our nonsense cell here and there

05:31.220 --> 05:40.580
we can delete Assad by pressing DTA so WTA now we have deleted the cell and they are also keyboard shortcuts

05:40.610 --> 05:46.260
to change the settings so now here by default we have the code setting.

05:46.580 --> 05:50.950
And now we can change from the setting to mark down by pressing in the command mode.

05:50.960 --> 05:54.650
Key M. There you can see.

05:54.720 --> 05:54.880
Yeah.

05:54.900 --> 06:03.090
Now change to mark down and we can change it back to code by pressing the wiki so we can see.

06:03.090 --> 06:09.270
Now we are back to code and there are many more shortcuts and we can have a look and also modify the

06:09.270 --> 06:13.370
shortcuts by going here to help and edit keyboard shortcuts.

06:14.490 --> 06:22.980
And there can see many shortcuts so cell and select the next cell shift and run the cell and staying

06:22.980 --> 06:28.920
in the cells control enter and run cell and insert a cell below us and end.

06:29.040 --> 06:37.420
So we already learned that then here enter the edit mode by pressing into.

06:37.500 --> 06:44.640
So again all these shortcuts only work if we are in the command mode not in the edit mode and what we

06:44.640 --> 06:52.920
also have here instead cell above a and insert cell below B and change the cell to code to some the

06:52.920 --> 06:57.270
wiki and change cell to mark down as the MP.

06:57.300 --> 07:03.290
And now there are many more shortcuts and it's a little bit a matter of taste if and which shortcuts

07:03.340 --> 07:05.050
you want to use actually.

07:05.100 --> 07:06.960
So it's completely up to you.

07:07.770 --> 07:09.280
So sometimes that's helpful.

07:09.300 --> 07:18.330
And in my opinion sometimes not all right and what I also want to show you we can actually star a value

07:18.360 --> 07:22.660
let's say five into a variable let's say.

07:22.670 --> 07:24.850
So a equals five.

07:25.220 --> 07:28.260
And we can actually execute a cell with a.

07:28.260 --> 07:30.780
So this is called printing.

07:30.780 --> 07:34.550
And now we get five cos Python knows a is five.

07:35.190 --> 07:41.670
And what we can do now we can change our calculations above and say OK I want to calculate a one plus

07:41.700 --> 07:51.050
a so and this gives us six and also for example here I want to calculate for plus a guess nine.

07:51.550 --> 07:56.620
Yeah maybe I want to change here to two plus a gives us seven.

07:56.860 --> 08:01.220
This is actually the good thing about took it out notebooks and what makes that Jupiter notebook so

08:01.220 --> 08:06.590
comfortable and easy to use that actually each cell is running independently from other cells.

08:06.620 --> 08:09.790
And now we can switch here from side to side run this.

08:09.800 --> 08:17.260
Uh let's uh and then go back to to our previous cell and we can see here on the left.

08:17.360 --> 08:17.630
Yeah.

08:17.640 --> 08:20.790
The sequence how we have run ourselves.

08:20.980 --> 08:28.860
So I actually owe this cell as your line for when we executed line five then line seven and then line

08:28.920 --> 08:29.440
eight.

08:29.520 --> 08:35.630
And for example let's make here something which Python cannot verify or place and do not know what to

08:35.630 --> 08:36.450
to do with it.

08:36.450 --> 08:41.170
So let's say to plus times three.

08:41.350 --> 08:43.030
So this is not defined in Python.

08:43.060 --> 08:49.210
And whenever we do something which is not not defined in Python then Python drops as an error message

08:50.610 --> 08:56.040
Yeah and give you can see the comfortable thing about two of the notebooks that we get an error message

08:56.040 --> 08:59.690
for only the cell which has code that is not defined.

08:59.700 --> 09:06.210
So this does however not impact the other side so all the other cells are still work and still show

09:06.210 --> 09:07.740
an output here.

09:07.740 --> 09:09.660
And this is in particular for beginners.

09:09.660 --> 09:16.380
Very convenient SSD encourages you to code by trial and error and you do not have to take care about

09:16.560 --> 09:22.200
making errors actually because you only get an error message for the particular cell and you can quickly

09:22.230 --> 09:24.720
edit your cell and change your error.

09:24.960 --> 09:28.410
So now here we know that the two plus times three does not work.

09:28.410 --> 09:32.850
So we can modify here and now we have changed it.

09:33.050 --> 09:41.290
And now let's assume we want to change a so a is not five but let's say seven then we see yes of the

09:41.290 --> 09:44.820
latest cell that was executed as the line eleven.

09:44.950 --> 09:46.410
And here we can see in line 8.

09:46.420 --> 09:49.670
So the output has not changed even if he changed.

09:49.780 --> 09:52.870
Line eleven where we defined equals seven.

09:52.900 --> 09:55.690
So in line eight where we calculate two plus a.

09:55.720 --> 10:00.630
This is still seven because before a was five and line eleven.

10:00.640 --> 10:05.680
So the reassignment of a was better than our line eight here.

10:05.770 --> 10:11.350
And now if you want to update your output to our new a we have to run the cell again.

10:11.350 --> 10:18.410
So now it's nine and we can see that the cell was executed after the new assignment of a slow.

10:18.470 --> 10:21.990
Now line twelve should already contain them the new A.

10:22.690 --> 10:27.520
So this is a very good thing about two billion notebooks so you can switch here from line to line and

10:27.520 --> 10:31.690
you can make errors and you can modify your arrows so no problem at all.

10:31.900 --> 10:38.920
However in the end it definitely makes sense to actually rearrange your code in sequence and that makes

10:38.920 --> 10:39.940
sense actually.

10:39.940 --> 10:45.400
So now we should put here the assignment of a to the very top of our code.

10:45.400 --> 10:50.160
So a seven and let's say we rewrite it again.

10:50.310 --> 10:57.290
And also here the printing of a we can move up.

10:57.970 --> 11:00.470
Then we rerun it.

11:00.700 --> 11:05.120
Now we can also rerun all the other cells on our two plus A's nine.

11:05.170 --> 11:12.850
We can delete the cell here for plus a short then B eleven and two plus three is still five.

11:12.850 --> 11:19.770
So now you can see here we have a sequence from top to bottom at the end it always makes sense to to

11:19.790 --> 11:25.880
rearrange for sequence then and that men are actually in what we can also do here by clicking to Kana

11:26.010 --> 11:32.310
then we can either restart the app to say Python or the pacing kernel and clear all output.

11:32.370 --> 11:36.210
So if you do that you can see here.

11:36.210 --> 11:37.490
So there is no output.

11:37.500 --> 11:43.690
We have still the code in our lines but the code is not executed and now we can execute our understanding

11:43.720 --> 11:49.240
here in a sequence that shift into.

11:49.270 --> 11:56.180
So now we have again the sequence on 1 2 5 and what we can also do we can do this in one step so we

11:56.180 --> 12:03.020
can clear our output and run the sets again beginning from line 1 by pressing a restart and run or

12:06.330 --> 12:11.570
so restarting the kernel and running it again makes definitely sense from time to time so if you have

12:11.570 --> 12:15.800
a very complex project with many lines in your stupid notebook.

12:15.800 --> 12:22.190
So at some point in time it makes sense to rearrange the sequence and then restart your code again.

12:22.340 --> 12:26.330
So sometimes the idea is a mistake or something that which doesn't work.

12:26.330 --> 12:32.490
And you actually do not know why it's not working and then it definitely makes sense to restart here.

12:32.510 --> 12:40.460
All right so let's save our notebook and let's close on the notebook here and we also shot our notebook

12:40.460 --> 12:41.680
down.

12:41.980 --> 12:45.020
Now that's one last thing I want to show you.

12:45.110 --> 12:47.570
So let's go back to our test to notebook

12:50.820 --> 12:56.930
so before we shut down here the notebook and now we open that again and we can still see here the output.

12:57.000 --> 13:03.510
However our notebook behaves like the SATs have never been run so our variable a is we are actually

13:03.510 --> 13:13.050
not start in Python and then we can try it by typing the three plus A's so we would expect 10 and we

13:13.050 --> 13:14.400
get an error message.

13:14.430 --> 13:15.720
Name a is not defined.

13:15.720 --> 13:22.390
So whenever we open my close notebook so all of the variables some other things then they are not start.

13:22.440 --> 13:31.960
So whenever we open a notebook again we have to go to kernel and restart and run all cells here.

13:32.010 --> 13:37.560
Now we can see we have a sequence from 1 2 6 and here three plus eight works and alternatively if we

13:37.560 --> 13:45.050
open the notebook we can run our cells here with just I'm going to stand here and say run all.

13:45.690 --> 13:52.560
So here we do not have a sequence from 1 2 to 6 but still we have run all sets them from the top to

13:52.560 --> 13:53.380
the bottom.

13:53.430 --> 13:57.960
So now we are finished with our installation and triple the notebook basics and I hope you enjoyed it

13:57.960 --> 14:00.300
and the see you in the next session by.
