Skip to content

Commit 97f8311

Browse files
MatMoorehelenst
authored andcommitted
Mention some possible errors in the python intro (DjangoGirls#933)
* Mention some possible errors in the python intro When showing how to define a function, mention some things that can go wrong, instead of saying "that was easy" From @vrutkovs suggestion in issue DjangoGirls#196: > People usually read the chapter line by line and get confused that > things break (on such an early stage). The coach has to know this > situation in beforehand and warn the student (I almost filed a bug about > incorrect syntax in the example) * Improve information about things that can go wrong - Use a list to make this section more distinct - Mention what happens if you indent the function call itself
1 parent 4f89a4d commit 97f8311

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

en/python_introduction/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,12 @@ Hi there!
793793
How are you?
794794
```
795795

796-
That was easy! Let's build our first function with parameters. We will use the previous example – a function that says 'hi' to the person running it – with a name:
796+
Note: if it didn't work, don't panic! The output will help you to figure why:
797+
- If you get a `NameError`, that probably means you typed something wrong, so you should check that you used the same name when creating the function with `def hi():` and when calling it with `hi()`.
798+
- If you get an `IndentationError`, check that both of the `print` lines have the same whitespace at the start of a line: python wants all the code inside the function to be neatly aligned.
799+
- If there's no output at all, check that the last `hi()` *isn't* indented - if it is, that line will become part of the function too, and it will never get run.
800+
801+
Let's build our first function with parameters. We will use the previous example – a function that says 'hi' to the person running it – with a name:
797802

798803
{% filename %}python_intro.py{% endfilename %}
799804
```python

0 commit comments

Comments
 (0)