Skip to content

Commit 0a9dd79

Browse files
authored
Merge pull request DjangoGirls#1685 from das-g/result-comparison
Add example of function result comparison and add more details to explanation of possible comparisons
2 parents 0f43950 + 692ce04 commit 0a9dd79

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

en/python_introduction/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ Dictionaries, like lists, are *mutable*, meaning that they can be changed after
398398
>>> participant['favorite_language'] = 'Python'
399399
```
400400

401-
Like lists, using the `len()` method on the dictionaries returns the number of key–value pairs in the dictionary. Go ahead and type in this command:
401+
Like lists, using the `len()` function on the dictionaries returns the number of key–value pairs in the dictionary. Go ahead and type in this command:
402402

403403
{% filename %}command-line{% endfilename %}
404404
```python
@@ -460,9 +460,11 @@ True
460460
True
461461
>>> 5 != 2
462462
True
463+
>>> len([1, 2, 3]) > len([4, 5])
464+
True
463465
```
464466

465-
We gave Python some numbers to compare. As you can see, not only can Python compare numbers, but it can also compare method results. Nice, huh?
467+
We gave Python some numbers to compare. As you can see, not only can Python compare numbers, but it can also compare values of mathematical expressions like `2 * 2` and function results like the `2` returned by `len([4, 5])`. Nice, huh?
466468

467469
Do you wonder why we put two equal signs `==` next to each other to compare if numbers are equal? We use a single `=` for assigning values to variables. You always, __always__ need to put two of them – `==` – if you want to check if things are equal to each other. We can also state that things are unequal to each other. For that, we use the symbol `!=`, as shown in the example above.
468470

0 commit comments

Comments
 (0)