Geek Culture
Published in

Geek Culture

Example of args and kwargs in Python

Hands-on examples of args and kwargs in Python

Photo by Jessica Da Rosa on Unsplash

With args, we can pass in any amount of non-keyword variables, while with kwargs we can pass in any amount of keyword arguments. We will explain the args and kwargs using an example of a sum function. More particularly, assume that we would like to build a function that sums up a list of numbers, without knowing the exact…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
George Pipis

George Pipis

Sr. Director, Data Scientist @ Persado | Co-founder of the Data Science blog: https://predictivehacks.com/