Functions

  • Lambda Functions

    Functions in Python usually have names, but sometimes you need a small function that you only need to use once. These are called lambda functions or lambda expressions. They are most often used when you want to pass a function to another function. This is possible because functions, like most things in Python, are objects.…

    Read more

  • Keyword and Variable Arguments

    If you place an asterisk before a parameter name, it allows you to specify multiple arguments, which will appear as a tuple. In this code, the first parameters is a normal parameter; the second is a variable parameter. Keyword Arguments When you supply arguments to a function, you can name the parameters (keyword arguments) rather…

    Read more

  • Python Main Functions

    It’s common for functions to call other functions, in programming generally. This can make it hard to see where the “entry point” of a program is. Where does the program actually start executing? For this reason, computer programs often have a function called main, which gets called before any other function. Main itself then calls…

    Read more

  • Introduction to Python Functions

    A function in programming is a block of code that you can run when you want, usually via its name. You can think of functions as like “black boxes”: you can pass data to a function (“function arguments“) and you can get data out of a function (“return values“). The function can process the data.…

    Read more

Blog at WordPress.com.