0
functions
def print_with_exclamation(word): print(word + "!") print_with_exclamation("spam") print_with_exclamation("eggs") print_with_exclamation("python") let me know the explanation of this coding..
2 Respostas
+ 1
Thinking that you know the syntax of function in python... Anyway, def is a keyword to define a function in python.. You named your function as print_with_exclamation()..and you need to pass a string as an argument to it.. So, whenever you call this funtion by passing a string.. For ex: spam, so,the function gets called and goes inside the function and performs the operation.. Here the operation is, you have to print the same string with '!' mark.. So, it prints "spam!" (without double quotes) again the function gets called and does the same thing... The number of times you call the function, the number of times it gets executed... Hope you understand.. 👍
0
Your calling the print_with_exclamation function with different parameters.
The function simply place the exclamation mark at the end of word that is placed as its parameter