The return value of a function's scope

# @Time: 2019/6/6 21:57 
# - * - encoding: UTF-8 - * - 
# ######################### ##### function return value and scope 
# external function code in order to obtain the execution result of the function, can use the return statement in a function and returns the result 
DEF stu_register (name, Age, Course = ' PY ' , Country = ' CN ' ):
     Print ( " ---- registered student information ------ " )
     Print ( " name: " , name)
     Print ( " Age: " , Age)
     Print ( " nationality: " , Country)
    Print ( " course: " , Course)
     IF Age> 22 is :
         return False
     the else :
         return True 

registriation_status = stu_register ( " King mountain artillery " , 22 is, Course = " PY whole stack development " , Country = ' JP ' )
 IF registriation_status:
     Print ( " registration success " )
 the else :
     Print ( " TOO BE A to Old Student. " )
 #Function encountered in the implementation process as long as the return statement stops execution and returns the result, it can also be understood as representing the end of the function return statement 

# If you do not specify a return in a function that returns None of this function

 

Guess you like

Origin www.cnblogs.com/Demo-simple/p/11139771.html