- 1
question about the output: if shout is placed before the last print statement, why does it give you a "no output" if you run the
def shout(word): """ Print a word with an exclamation mark following it. """ shout("spam") print(word + "!")
1 Odpowiedź
0
Because you made an infinate recursive function. If its called just once, it will continue to call itself over and over since you put a function call of the same function, within said function.
Try:
def shout(word):
return word + '!'
Then when you type...
print(shout(spam))
Output will be:
spam!