- 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 + "!")

14th Jun 2020, 11:23 AM
H Liu
1 Réponse
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!
14th Jun 2020, 11:35 AM
Slick
Slick - avatar