# def 函数
def function(a,b):
return a+b
print("this is func result:")
print(function(2,3))
print("this is func result:",function(3,5))
#默认函数参数
def saleCar(price,color="red",brand="dazhong",second_hand=False):
print('print:',price,
'color:',color,
'brand:',brand,
'second_hand:',second_hand)
saleCar(1000,'red','carmy',True)
saleCar(10300,second_hand=True)
# 没有默认的参数一样要放在前面,默认参数要放在后面
# non-default argument follows default argument
# def car(price,color="red",brand,second_hand=False):
def car(price,brand,color="red",second_hand=False):
print('print:',price,
'color:',color,
'brand:',brand,
'second_hand:',second_hand)
car(1000,'canne')
def function(a,b):
return a+b
print("this is func result:")
print(function(2,3))
print("this is func result:",function(3,5))
#默认函数参数
def saleCar(price,color="red",brand="dazhong",second_hand=False):
print('print:',price,
'color:',color,
'brand:',brand,
'second_hand:',second_hand)
saleCar(1000,'red','carmy',True)
saleCar(10300,second_hand=True)
# 没有默认的参数一样要放在前面,默认参数要放在后面
# non-default argument follows default argument
# def car(price,color="red",brand,second_hand=False):
def car(price,brand,color="red",second_hand=False):
print('print:',price,
'color:',color,
'brand:',brand,
'second_hand:',second_hand)
car(1000,'canne')