Tutorial A1 – Solutions¶
1 Get your hands on a working installation of Python 3, install Jupyter, and open the exercise solution template.
Task 1 is completed successfully as this notebook is running.
2 Make Python put a Greeting on the screen (fill in your own name) and comment your code!
Hello, <insert_name>! How's your day?
[1]:
print("Hello, Iggy! How's your day?")
# A friendly greeting
Hello, Iggy! How's your day?
3 Make Python raise a SyntaxError
and a NameError
.
[2]:
( # raises SyntaxError
File "<ipython-input-2-b3a827af6b79>", line 1
( # raises SyntaxError
^
SyntaxError: unexpected EOF while parsing
[3]:
a # raises NameError
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-3-da833d585a90> in <module>
----> 1 a # raises NameError
NameError: name 'a' is not defined