8000 GitHub - APaud3l/T1W7-Tuesday
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

APaud3l/T1W7-Tuesday

Repository files navigation

Functions

  • One of the best tools for following DRY Coding Principles
  • Blocks of code that performs a specific task, like your phone's features.
  • Can be reused, and helps make the program modular and manageable.

Syntax:

  • Defining a function
    def function_name(parameters):
        # Code blocks
        return value
  • Calling a function
    function_name(arguments)

Scope

  • Children can access parent's scope
  • Parents cannot access children's scope

'return' keyword

  • Returns a value from a function
  • Also, immediately ends the function
  • Multiple possible return values in a function

Arguments and Parameters

  • Arguments are values you can pass to the function
  • Parameters are variables that allows us to pass arguments to our function
  • Positional Arguments: Arguments that are passed to a function in the correct positional order.
  • Default Arguments/ Optional Parameters: Parameters that assume value if a value is not provided.
  • Keyword Arguments: Arguments that are passed to a function by explicitly stating the parameter name.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0