Question: > > > def print _ lyrics ( ) : . . . print ( I ' m a lumberjack, and I ' m
def printlyrics:
printIm a lumberjack, and Im okay."
printI sleep all night and I work all day."
To end the function, you have to enter an empty line.
Defining a function creates a function object, which has type function:
printprintlyrics
typeprintlyrics
The syntax for calling the new function is the same as for builtin functions:
printlyrics
Im a lumberjack, and Im okay.
I sleep all night and I work all day.
Once you have defined a function, you can use it inside another function. For example, to
repeat the previous refrain, we could write a function called repeatlyrics:
def repeatlyrics:
printlyrics
printlyrics
And then call repeatlyrics:
repeatlyrics
Im a lumberjack, and Im okay.
I sleep all night and I work all day.
Im a lumberjack, and Im okay.
I sleep all night and I work all day.
But thats not really how the song goes
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
