Skip to content

Commit 0b7b7f6

Browse files
committed
Update 2.md
1 parent 276bb1b commit 0b7b7f6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

2.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ TypeError: unsupported operand type(s) for /: 'str' and 'str'
9292
Variables are easy to understand. They simply contain data. _[*]_
9393

9494
```py
95-
>>> a = 1 # create a variable called a and assigns 1 to it
95+
>>> a = 1 # create a variable called a and assign 1 to it
9696
>>> a # get the value of a
9797
1
9898
>>>
@@ -173,7 +173,7 @@ Now you also understand why typing hello to the prompt didn't work in the beginn
173173

174174
### Booleans and None
175175

176-
In Python, and many other programming languages, `=` is assigning and `==` is comparing. `a = 1` sets a to 1 and `a == 1` checks if a is 1.
176+
In Python, and many other programming languages, `=` is assigning and `==` is comparing. `a = 1` sets a to 1 and `a == 1` checks if a equals 1.
177177

178178
```py
179179
>>> a = 1
@@ -187,7 +187,7 @@ True
187187
>>>
188188
```
189189

190-
`a == 2` is the same as `(a == 2) == True`. `a == 2` is more readable, so `== True` needs to be used very rarely.
190+
`a == 1` is the same as `(a == 1) == True`. `a == 1` is more readable, so `== True` needs to be used very rarely.
191191

192192
```py
193193
>>> a = 1
@@ -203,7 +203,7 @@ False
203203
>>>
204204
```
205205

206-
True and False are boolean values. In Python they're built-in variables. There's also None, which is often used as a default value. All these can be saved to variables, just like integers, floats and strings.
206+
True and False are boolean values. In Python they're built-in variables. _[*]_ There's also None, which is often used as a default value. All these can be saved to variables, just like integers, floats and strings.
207207

208208
```py
209209
>>> a = True
@@ -219,6 +219,8 @@ None
219219
>>>
220220
```
221221

222+
_[*] In Python 3, True, False and None are actually keywords, but they behave just like variables._
223+
222224
There are other comparing operators than `==` too:
223225

224226
| Usage | Description | True examples |
@@ -237,7 +239,7 @@ There are other comparing operators than `==` too:
237239

238240
_[*] These are not always correct, but this tutorial is about Python's basics, not about cool tricks we can do with it. See [this](https://docs.python.org/3/library/stdtypes.html#truth-value-testing) for more info._
239241

240-
There is more than one way to do some things. For example, to check if a is not equal to 1 you could do `a != 1` or `not a == 1`. To check if a is not in b you could do `a not in b` or `not a in b`. However, `!=` and `not in` should be used when possible because they're more convinient once you get used to them.
242+
There is more than one way to do some things. For example, to check if a is not equal to 1 you could do `a != 1` or `not a == 1`. To check if b does not contain a you could do `a not in b` or `not a in b`. However, `!=` and `not in` should be used in cases like this because they're more convinient once you get used to them.
241243

242244
There's also `is`, but don't use it instead of `==` unless you know what you are doing.
243245

0 commit comments

Comments
 (0)