Advertisement
Mushi

args

Sep 19th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. def my_methond(arg1, arg2):
  2.     return arg1 + arg2
  3.  
  4. my_methond(5, 6)
  5.  
  6. def my_long_methond(arg1, arg2, arg3, arg4, arg5, arg6):
  7.     return arg1 + arg2 + arg3 + arg4 + arg5 + arg6
  8.  
  9. def my_list_addition(list_arg):
  10.     return sum(list_arg)
  11.  
  12. my_long_methond(3,5,7,12,14,55)
  13.  
  14. my_list_addition([3,5,7,12,14,55])
  15.  
  16. def addition_simplified(*args):
  17.     return sum(args)
  18.  
  19. addition_simplified(3,5,7,12,14,55)
  20.  
  21. ##
  22.  
  23. def what_are_kwargs(*args, **kwargs):
  24.     print(args)
  25.     print(kwargs)
  26.  
  27. what_are_kwargs(12,34,56,name='Jose',location='UK')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement