Skip to content

Instantly share code, notes, and snippets.

@swshan
Created November 10, 2015 15:23
Show Gist options
  • Save swshan/84c858ef9f22ee525f00 to your computer and use it in GitHub Desktop.
Save swshan/84c858ef9f22ee525f00 to your computer and use it in GitHub Desktop.
Learning Python example for argument
#coding=utf-8
def function_get_args(a,b,c):
print a,b,c
return_val = a * 5
return return_val
def function_get_args_return_tuple(a,b,c):
print a,b,c
return_val = a * 5
return return_val, b
def function_get_args_return_dict(a,b,c):
print a,b,c
return_val = a * 5
return {'k1': a, 'k2': b, 'k3': c * 10}
if __name__ == '__main__':
r = function_get_args('blll', 'a', 'c')
print r
print '=========='
r2 = function_get_args_return_tuple('a', 'b', 'c')
print r2
print '=========='
r3 = function_get_args_return_dict('a', 'b', 'c')
print r3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment