# Use **kwargs to pass any # of named arguments to a function # **kwargs become a dictionary you can use in the function: def print_kwargs(**kwargs): print(kwargs) print_kwargs(goku=9001,krillin=1500, piccolo=2500) def extract_kwargs(**kwargs): # Extract and print keys print([*kwargs]) # Extract and print values print([*kwargs.values()]) extract_kwargs(goku=9001,krillin=1500, piccolo=2500) # Note that the "**" symbol is what is important # "kwargs" could by anything! def other_word_for_kwargs(**kw_params): print(kw_params) other_word_for_kwargs(goku=9001,krillin=1500, piccolo=2500, DataDaft=13839)
@antonborkovski10283 жыл бұрын
So underrated channel!! Bro,' please continue your amazing work!
@coreygish75166 ай бұрын
Hey! Thanks I was struggling to understand kwargs from Bro Codes tutorial but this helped me get the rest of the way!
@RF-wb7ei2 ай бұрын
Loved the kwargs you used
@ravindukavinda41203 жыл бұрын
Good work brother. from sri lanka...
@joeg4642 жыл бұрын
Great explanation. Thank you.
@funnyclips26962 жыл бұрын
Well, that's educating. However, I've not seen any difference in using *args and **kwargs Because, I interchanged them and the result is the same. Pls, if there's any difference in usage, enlighten me further. Thanks