# Yuanzu as a function parameter def sum_numbers(*args): sum = 0 for item in args: sum += item return sum print(sum_numbers(1, 2, 3, 4, 5)) # The function parameter of sum_numbers is because it is a Yuanzu, Therefore, in theory, the number of parameters can be increased without limit;
# An example of calling Yuanzu and dictionary as parameters at the same time def show_list_dictionary(*args, **kwargs): print(args) print(kwargs) show_list_dictionary(1, 2, 3, 4, name="roger", age=19) # Directly use the element of the ancestor and the dictionary as function parameters foo_list = (1, 2, 3, 4, 5, 6, 7, 8) roger_dictionary = {"name": "roger", "age": 25} show_list_dictionary(*foo_list , **roger_dictionary) # Take the ancestor and dictionary as function parameters, * symbol is used to unpack the list, ** symbol is used to unpack the dictionary