You are on page 1of 3

WEBVTT

1
00:00:04.000 --> 00:00:08.000
Alright let's start this section by a discussion of variables and a built in

2
00:00:08.000 --> 00:00:12.000
primitive types in Python including integers

3
00:00:12.000 --> 00:00:16.000
floats, booleans, and strings. So here I'm going to define

4
00:00:16.000 --> 00:00:20.000
a few variables, starting with the first one, students

5
00:00:20.000 --> 00:00:24.000
count. Note that here all the letters are lower case

6
00:00:24.000 --> 00:00:28.000
and we're using an underscore to separate multiple words.

7
00:00:28.000 --> 00:00:32.000
This is the naming convention we use in Python. So here we set

8
00:00:32.000 --> 00:00:36.000
students count to let's say 1000 this is an example of a

9
00:00:36.000 --> 00:00:40.000
integer, let's look at an example of a float, so we set rating

10
00:00:40.000 --> 00:00:44.000
to 4 let's say 99, here's

11
00:00:44.000 --> 00:00:48.000
another variable, is published let's set this to true

12
00:00:48.000 --> 00:00:52.000
or false, note that the first letter is

13
00:00:52.000 --> 00:00:56.000
upper case, and finally let's take a look at an example of a

14
00:00:56.000 --> 00:01:00.000
string. So we set course name to Python.

15
00:01:00.000 --> 00:01:04.000
Now in Python you can either use double quotes or single

16
00:01:04.000 --> 00:01:08.000
quotes. Or you can use triple quotes if you're string

17
00:01:08.000 --> 00:01:12.000
has multiple lines. For example, here I can put

18
00:01:12.000 --> 00:01:16.000
triple quotes and in between them I can add

19
00:01:16.000 --> 00:01:20.000
a string that has multiple lines, okay?

20
00:01:20.000 --> 00:01:24.000
Now one interesting feature in Python is you can

21
00:01:24.000 --> 00:01:28.000
initialize multiple variables on the same line. For example, let

22
00:01:28.000 --> 00:01:32.000
say we have coordinates like x and y, we can

23
00:01:32.000 --> 00:01:36.000
initialize these two on the same line. So we can set x

24
00:01:36.000 --> 00:01:40.000
comma y, we set it to 1, 2

25
00:01:40.000 --> 00:01:44.000
this line is exactly equivalent to these two lines.

26
00:01:44.000 --> 00:01:48.000
So, its a short cut. And finally just like

27
00:01:48.000 --> 00:01:52.000
almost every programming language, we can set multiple variables to the same

28
00:01:52.000 --> 00:01:56.000
value. For example, we can set x and y to

29
00:01:56.000 --> 00:02:00.000
1. So these are the basics of variables. Next I will
30
00:02:00.000 --> 00:02:04.000
talk about dynamic nature of Python.

You might also like