WEBVTT

00:00.740 --> 00:07.160
When you are using variables in Python, you need to adhere to a few rules and guidelines.

00:07.280 --> 00:10.370
Breaking some of these rules will cause errors.

00:10.400 --> 00:17.810
Other guidelines just help you write code that's easier to read and understand, so be sure to keep

00:17.810 --> 00:19.520
these rules so.

00:19.550 --> 00:20.840
Variable names.

00:20.870 --> 00:22.310
Variable names.

00:22.310 --> 00:28.590
So variable names can contain only letters, numbers and underscores.

00:28.610 --> 00:32.450
Here, variable names can contain only letters.

00:34.770 --> 00:35.940
Numbers.

00:37.730 --> 00:39.530
And underscores.

00:40.470 --> 00:45.990
They can start with a letter or an underscore, but not with a number.

00:45.990 --> 00:53.550
So as I said, variable names cannot start with number.

00:53.550 --> 00:56.320
So here, let's try this one.

00:56.340 --> 00:57.150
Var.

00:58.110 --> 00:58.610
Here.

00:59.770 --> 01:01.240
As you can see here, Rozelle.

01:01.620 --> 01:02.080
Rozelle.

01:02.140 --> 01:05.380
And in the end of statement expected.

01:05.500 --> 01:11.260
So as you can as you can see here, we are getting an error because variable names cannot start with

01:11.260 --> 01:12.100
a number.

01:13.000 --> 01:22.690
So, for example, you can also call this message one, it's okay, but you cannot call one message.

01:23.050 --> 01:24.580
Actually, let's try this here.

01:25.360 --> 01:26.550
Message one.

01:26.560 --> 01:28.660
As you can see, we are getting no errors.

01:28.660 --> 01:29.920
But you cannot.

01:29.920 --> 01:30.550
Right?

01:30.580 --> 01:37.030
Name your variable one message or one message without underscore.

01:38.320 --> 01:43.870
Here and spaces are not allowed in variable names.

01:43.870 --> 01:45.700
So here, message here.

01:45.700 --> 01:46.660
Let's write this.

01:46.690 --> 01:47.530
My message.

01:47.530 --> 01:53.970
And here this is a this is okay variable name, but we make space here.

01:53.980 --> 01:55.660
We will get an error.

01:56.890 --> 01:57.940
Instead of using space.

01:57.940 --> 02:01.570
You can also use underscores and you will get no errors here.

02:02.350 --> 02:07.420
Avoid using Python keywords and function names as variable names.

02:07.420 --> 02:08.080
For example.

02:08.080 --> 02:12.070
Do not use the word print as a variable name.

02:12.280 --> 02:18.400
Python has a reserved for a particular programming and programmatic purpose.

02:19.260 --> 02:23.940
And the variable names should not be short but descriptive.

02:23.970 --> 02:31.590
For example, the name is better than N right and the student name here.

02:31.590 --> 02:39.450
Student name is better than student name is better than s n here.

02:39.450 --> 02:40.020
Right.

02:40.230 --> 02:41.100
So.

02:42.710 --> 02:44.450
And name length.

02:44.480 --> 02:49.640
Name length is better than length.

02:51.020 --> 02:52.460
Length.

02:53.000 --> 02:55.010
Of length.

02:56.730 --> 02:57.990
A person's.

02:59.520 --> 03:00.690
Person's name.

03:01.750 --> 03:13.720
And also be careful when using the lowercase letter L and uppercase letter L, because they will.

03:13.720 --> 03:16.930
They could be confused with the numbers one and zero.

03:18.840 --> 03:23.820
It can take some practices to learn how to create good variable names, especially as your programs

03:23.820 --> 03:29.310
become more interesting and complicated as you write more programs and start to read through other people's

03:29.310 --> 03:33.780
code, you will get better at coming up with meaningful names.
