← 返回列表

Python3 Return 语句

Python3 Return 语句 #!/usr/bin/python3 # Function definition is here def sum( arg1, arg2 ): # Add both the parameters and return them." total = arg1 + arg2 print ("Inside the function : ", total) return total # Now you can call sum function total = sum( 10, 20 ) print ("Outside the function : ", total )

Python3 Return 语句

#!/usr/bin/python3

# Function definition is here
def sum( arg1, arg2 ):
   # Add both the parameters and return them."
   total = arg1 + arg2
   print ("Inside the function : ", total)
   return total

# Now you can call sum function
total = sum( 10, 20 )
print ("Outside the function : ", total )

打开资源 ↗

交流与评论