: Appears at the end of a function definition statement
such as: if expression:
Elif expression:
else: etc
Defining functions Using Def
def Hanshu (x)
Description
Return (the value returned when the function is called)
The usage of default parameters is not very clear:
def foo (debug=true):
' Detemine if in debug mode with default argument '
If debug:
print ' in debug mode '
print ' Done '
The output is ' done ' when the value is False
If the true value only wants to output the first sentence, I think I should add continue to jump out of the loop,
But in reality, I've added continue to the error.
Class calls internal properties
First, define a class, and the properties and methods inside the class, such as:
If the base class must be defined as object, define ABC error
Class Hello (object):
a=0.5
The function is defined earlier
def add (x)
Return (X+X)
function call class with parameter
Add (HELLO.A)
Output is 1
Python Learning record 3