Skip to content

Commit bcec00e

Browse files
committed
blank lines
1 parent c792fc0 commit bcec00e

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

basics/answers.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ isn't exactly like mine but it works just fine it's ok, and you can
2727
2. The broken code has mostly the same issues as exercise 1. Here are
2828
the problems that excercise 1 doesn't have:
2929

30+
- The if-elif-else has a blank line at a confusing place. Delete it.
31+
- After deleting the code, it looks quite dense. Add a new blank
32+
line before the `if`.
3033
- The elif line is missing a `:` at the end.
3134
- On the last line the comma is on the wrong side. `"bla bla,"` is
32-
a string that **contains** a comma, but `"bla bla",` is a
33-
string and a **separate** comma. In this exercise, the last
34-
line should be
35-
`print("I don't know what", something, "means.")`
35+
a string that **contains** a comma, but `"bla bla",` is a
36+
string and a **separate** comma. In this exercise, the last
37+
line should be `print("I don't know what", something, "means.")`
3638

3739
3. We can simply ask the word with input and print `word * 1000`.
3840

basics/if.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,20 @@ else:
245245
Now the `else` belongs to the `if 1 == 2` part and **it has nothing to
246246
do with the `if 1 == 1` part**. On the other hand, the elif version
247247
**grouped the multiple ifs together** and the `else` belonged to all of
248-
them.
248+
them. Adding a blank line makes this obvious:
249+
250+
```python
251+
if 1 == 1:
252+
print("hello")
253+
254+
if 1 == 2:
255+
print("this is weird")
256+
else:
257+
print("world")
258+
```
259+
260+
In general, adding blank lines to appropriate places is a good idea. If
261+
you are asked to "fix code", feel free to add missing blank lines.
249262

250263
## Summary
251264

@@ -276,6 +289,7 @@ them.
276289
something = input("Enter something: ")
277290
if something = 'hello':
278291
print("Hello for you too!")
292+
279293
elif something = 'hi'
280294
print('Hi there!')
281295
else:

0 commit comments

Comments
 (0)