forked from jmelahman/python-for-everybody-solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise4_2.py
More file actions
executable file
·32 lines (23 loc) · 730 Bytes
/
exercise4_2.py
File metadata and controls
executable file
·32 lines (23 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
"""
Exercise 4.2 Move the last line of this program to the top, so the function
call appears before the definitions. Run the program and see what error
message you get.
Code: http://www.py4e.com/code3/lyrics.py
Python for Everybody: Exploring Data Using Python 3
by Charles R. Severance
"""
repeat_lyrics()
def repeat_lyrics():
print_lyrics()
print_lyrics()
def print_lyrics():
print("I'm a lumberjack, and I'm okay.")
print('I sleep all night and I work all day.')
"""
Error message:
Traceback (most recent call last):
File "/home/jamison/workspace/python-for-everybody/exercise4_2.py", line 14, in <module>
repeat_lyrics()
NameError: name 'repeat_lyrics' is not defined
"""