Benny has been playing coding games where he was using very simple functions.
"Benny I use functions on my computer too! Come see!"
def my_function():
print("hi Benny")
"This is my function. It says "Hi Benny". It's like the functions in your game. What do you think is going to happen if I call the function?"
def my_function():
print("hi Benny")
my_function()
Benny laughs.
"What do you think is going to happen if I call the function five times?"
def my_function():
print("hi Benny")
my_function()
my_function()
my_function()
my_function()
my_function()
Benny laughs loud.
"Why don't I change the name of my function to "say_hi_to_Benny"?"
def say_hi_to_Benny():
print("hi Benny")
say_hi_to_Benny()
say_hi_to_Benny()
say_hi_to_Benny()
say_hi_to_Benny()
say_hi_to_Benny()
Benny laughs less loud.
"What if I make a function that calls the other function five times? What do you think's going to happen?"
def say_hi_to_Benny():
print("hi Benny")
def say_hi_to_Benny_5_times():
say_hi_to_Benny()
say_hi_to_Benny()
say_hi_to_Benny()
say_hi_to_Benny()
say_hi_to_Benny()
"Nothing happened! Because I didn't call the function. What do you think's going to happen if I call the function?"
def say_hi_to_Benny():
print("hi Benny")
def say_hi_to_Benny_5_times():
say_hi_to_Benny()
say_hi_to_Benny()
say_hi_to_Benny()
say_hi_to_Benny()
say_hi_to_Benny()
say_hi_to_Benny_5_times()
Benny laughs but I can tell he's losing interest so we stop there.