File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Variables
4
4
5
- Variables are easy to understand. They simply ** contain data** . Actually
6
- they [ point to data] ( https://www.youtube.com/watch?v=_AEJHKGk9ns ) , but
7
- think about them as data containers for now.
5
+ Variables are easy to understand. They simply ** point to data** .
8
6
9
7
``` py
10
- >> > a = 1 # create a variable called a and assign 1 to it
11
- >> > a # get the value of a and let Python echo it
8
+ >> > a = 1 # create a variable called a that points to 1
9
+ >> > a # get the value that a points to
12
10
1
13
11
>> >
14
12
```
15
13
16
14
We can also change the value of a variable after setting it.
17
15
18
16
``` py
19
- >> > a = 2
17
+ >> > a = 2 # make it point to 2 instead
20
18
>> > a
21
19
2
22
20
>> >
@@ -47,6 +45,21 @@ use underscores.
47
45
>> >
48
46
```
49
47
48
+ Variable names are case-sensitive, like many other things in Python.
49
+
50
+ ``` py
51
+ >> > thing = 1
52
+ >> > THING = 2
53
+ >> > thIng = 3
54
+ >> > thing
55
+ 1
56
+ >> > THING
57
+ 2
58
+ >> > thIng
59
+ 3
60
+ >> >
61
+ ```
62
+
50
63
Python also has some words that cannot be used as variable names
51
64
because they have a special meaning. They are called ** keywords** , and
52
65
you can run ` help('keywords') ` to see the full list if you want to.
You can’t perform that action at this time.
0 commit comments