We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2d761a8 commit 24dd941Copy full SHA for 24dd941
session_05/answers/A5.py
@@ -0,0 +1,33 @@
1
+#A5 - Add up all the numbers from 1 to 500 and print the answer
2
+
3
+total = 0
4
5
+for x in range(1, 501):
6
+ total += x
7
8
+print(total)
9
10
11
+# Another way
12
13
+number = 1
14
15
+while number <= 500:
16
+ total = total + number
17
+ number = number + 1
18
19
20
21
22
23
24
25
26
+while True:
27
28
29
30
+ if number > 500:
31
+ break
32
33
session_06/slides/session_6.md
@@ -206,7 +206,6 @@ student = {
206
}
207
```
208
209
-
210
---
211
212
# Collections — Dictionary
0 commit comments