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
@@ -59,11 +59,11 @@ We will be coding from the **terminal**, also referred to as the **command line*
59
59
```
60
60
python3
61
61
```
62
-
62
+
63
63
An output similar to the following displays, showing that you are in the Python Interactive Shell:
64
64
65
65
```
66
-
Python 3.9.12 (main, <date>, <time>)
66
+
Python 3.9.12 (main, <date>, <time>)
67
67
[GCC 5.4.0 20160609] on <OS>
68
68
Type "help", "copyright", "credits" or "license" for more information.
69
69
>>>
@@ -84,12 +84,12 @@ So how do we get Python to display "Hello World"? The answer is: via the `print(
84
84
- The brackets `()` contain the text you want to print
85
85
- The text must be contained in quotation marks `" "` or `' '`
86
86
87
-
1. Type the following command into the shell and hit enter:
87
+
1. Type the following command into the shell and hit enter:
88
88
89
89
```
90
90
print("Hello world")
91
91
```
92
-
92
+
93
93
The following output displays:
94
94
95
95
```
@@ -117,7 +117,7 @@ Variables are used to store and label data. They are a key part of any programmi
117
117
```
118
118
print(my_new_variable)
119
119
```
120
-
120
+
121
121
The following output displays:
122
122
123
123
```
@@ -159,7 +159,7 @@ Variables are used to store and label data. They are a key part of any programmi
159
159
```
160
160
print(my_new_variable)
161
161
```
162
-
162
+
163
163
The following output displays:
164
164
165
165
```
@@ -176,7 +176,7 @@ Variables are used to store and label data. They are a key part of any programmi
176
176
total_animals = dogs + cats
177
177
print(total_animals)
178
178
```
179
-
179
+
180
180
The following output displays, showing you the total number of dogs and cats:
181
181
182
182
```
@@ -236,7 +236,7 @@ We assume that, as per our previous commands, we already have the variables `dog
236
236
- The second line is indented with a tab or four spaces, and contains the command to execute if the condition is fulfilled.
237
237
Indentation is crucial in Python for the code to be interpreted correctly. Make sure you always follow the indentation pattern shown in examples.
238
238
</Message>
239
-
239
+
240
240
Hit enter twice after you have finished typing, to make it clear to the Python shell that you do not have any other elements to add to this command.
241
241
242
242
The following output displays:
@@ -277,7 +277,7 @@ We assume that, as per our previous commands, we already have the variables `dog
277
277
278
278
We have 2 cats and 4 dogs, so the printed statement is true!
279
279
280
-
However, what if we had an equal number of dogs and cats?
280
+
However, what if we had an equal number of dogs and cats?
281
281
282
282
4. Enter the following into the Python shell:
283
283
@@ -395,7 +395,7 @@ So far, we've been doing all our coding in the Python Interactive Shell, where y
395
395
Python has read our `.py` file and the output displays directly to the terminal. This makes it really easy to edit and play around with the code in your file, save it, and run it again to see how your changes affect the output. If you navigate within the terminal to the location of the file (in this case, via `cd /home/users/`) you can run the code directly just by typing `python3 animals.py`.
396
396
397
397
Let's try modifying the code in our file one final time.
398
-
398
+
399
399
6. Open `animals.py` in your text editor, overwrite the existing code with the following, and save:
0 commit comments