You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/python_introduction/README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ Type "help", "copyright", "credits" or "license" for more information.
28
28
29
29
After running the Python command, the prompt changed to `>>>`. For us this means that for now we may only use commands in the Python language. You don't have to type in `>>>` – Python will do that for you.
30
30
31
-
If you want to exit the Python console at any point, just type `exit()` or use the shortcut `Ctrl + Z` for Windows and `Ctrl + D` for Mac/Linux. Then you won't see `>>>` any longer.
31
+
If you want to exit the Python console at any point, type `exit()` or use the shortcut `Ctrl + Z` for Windows and `Ctrl + D` for Mac/Linux. Then you won't see `>>>` any longer.
32
32
33
33
For now, we don't want to exit the Python console. We want to learn more about it. Let's start by typing some math, like `2 + 3` and hitting `enter`.
34
34
@@ -101,7 +101,7 @@ or escaping the apostrophe with a backslash (`\`):
101
101
"Runnin' down the hill"
102
102
```
103
103
104
-
Nice, huh? To see your name in uppercase letters, simply type:
104
+
Nice, huh? To see your name in uppercase letters, type:
105
105
106
106
{% filename %}command-line{% endfilename %}
107
107
```python
@@ -174,7 +174,7 @@ Let's say we want to create a new variable called `name`:
174
174
175
175
We type name equals Ola.
176
176
177
-
As you've noticed, your program didn't return anything like it did before. So how do we know that the variable actually exists? Simply enter`name` and hit `enter`:
177
+
As you've noticed, your program didn't return anything like it did before. So how do we know that the variable actually exists? Enter`name` and hit `enter`:
178
178
179
179
{% filename %}command-line{% endfilename %}
180
180
```python
@@ -199,7 +199,7 @@ You can use it in functions too:
199
199
5
200
200
```
201
201
202
-
Awesome, right? Of course, variables can be anything – numbers too! Try this:
202
+
Awesome, right? Now, variables can be anything – numbers too! Try this:
203
203
204
204
{% filename %}command-line{% endfilename %}
205
205
```python
@@ -386,7 +386,7 @@ KeyError: 'age'
386
386
387
387
Look, another error! This one is a **KeyError**. Python is helpful and tells you that the key `'age'` doesn't exist in this dictionary.
388
388
389
-
When should you use a dictionary or a list? Well, that's a good point to ponder. Just have a solution in mind before looking at the answer in the next line.
389
+
When should you use a dictionary or a list? Well, that's a good point to ponder. Think about the answer before looking at it in the next line.
390
390
391
391
- Do you just need an ordered sequence of items? Go for a list.
392
392
- Do you need to associate values with keys, so you can look them up efficiently (by key) later on? Use a dictionary.
@@ -408,7 +408,7 @@ Like lists, using the `len()` method on the dictionaries returns the number of k
408
408
409
409
I hope it makes sense up to now. :) Ready for some more fun with dictionaries? Read on for some amazing things.
410
410
411
-
You can use the `pop()` method to delete an item in the dictionary. Say, if you want to delete the entry corresponding to the key `'favorite_numbers'`, just type in the following command:
411
+
You can use the `pop()` method to delete an item in the dictionary. Say, if you want to delete the entry corresponding to the key `'favorite_numbers'`, type in the following command:
412
412
413
413
{% filename %}command-line{% endfilename %}
414
414
```python
@@ -446,7 +446,7 @@ Excited for the next part? :)
446
446
447
447
> For readers at home: this part is covered in the [Python Basics: Comparisons](https://www.youtube.com/watch?v=7bzxqIKYgf4) video.
448
448
449
-
A big part of programming involves comparing things. What's the easiest thing to compare? Numbers, of course. Let's see how that works:
449
+
A big part of programming involves comparing things. What's the easiest thing to compare? Numbers! Let's see how that works:
450
450
451
451
{% filename %}command-line{% endfilename %}
452
452
```python
@@ -521,7 +521,7 @@ There are only two Boolean objects:
521
521
- True
522
522
- False
523
523
524
-
But for Python to understand this, you need to always write it as 'True' (first letter uppercase, with the rest of the letters lowercased). __true, TRUE, and tRUE won't work – only True is correct.__ (The same applies to 'False' as well, of course.)
524
+
But for Python to understand this, you need to always write it as 'True' (first letter uppercase, with the rest of the letters lowercased). __true, TRUE, and tRUE won't work – only True is correct.__ (The same applies to 'False' as well.)
525
525
526
526
Booleans can be variables, too! See here:
527
527
@@ -562,7 +562,7 @@ So far we've been writing all our python code in the interpreter, which limits u
562
562
- Save some code into a new python file
563
563
- Run it!
564
564
565
-
To exit from the Python interpreter that we've been using, simply type the `exit()` function
565
+
To exit from the Python interpreter that we've been using, type the `exit()` function
566
566
567
567
{% filename %}command-line{% endfilename %}
568
568
```python
@@ -633,7 +633,7 @@ And on Windows Powershell, it will be like this:
633
633
<!--endsec-->
634
634
635
635
636
-
If you get stuck, just ask for help.
636
+
If you get stuck, ask for help.
637
637
638
638
Now use Python to execute the code in the file like this:
0 commit comments