Def print_messages (text_messages show_messages) :
While text_messages:
Current_messages=text_messages. Pop ()
Print (f "Printing message: {current_messages}")
Show_messages. Append (current_messages)
Def print_show_messages (show_messages) :
Print (" f \ nThe following messages have had printed: ")
For show_message show_messages in:
Print (show_message)
Text_messages=[" both Please forgive me, "" I 'm sorry," "Don' t hate me", "I knew it"]
Show_messages=[]
I compare notes case is found, finally need to add a custom function when funtion expressions initialization:
Print_messages (text_messages show_messages)
Print_show_messages (show_messages)
The content of the code execution result is def inside, why want to add the function name to display the results?
CodePudding user response:
Function need to be able to play a role in the process,The first to define, is you the above part def
The next to be called, is the part that you write the following
Just like you to write a composition (programming), you must first define the word library (definition) of Chinese characters, to write articles to make sentences with words (call),
CodePudding user response:
System at two kinds of function, the user customization,Systems, can be used directly, such as print (' XXX '), STR () and so on, the function of this kind of function is prepared in advance,
User-defined, define functions to realize the function of the first, is def functio () : the function, using the function ()
CodePudding user response:
Most of the programming language, function is the key, in python, and object-oriented class, come on,