Coding 101 18: Python: Defining Functions

Coding 101 18: Python: Defining Functions

00:00

Hosts: Fr. Robert Ballecer, SJ and Shannon Morse

Guest: Dale Chase

Welcome to Coding 101 - It's the TWiT show that gives YOU the knowledge to live in the wonderful world of the programmer. This week we are introducing our newest module, Python with Code Warrior Dale Chase!


To see all the code used in today's episode, go to Our Github Repository for Module 2

Ivory Tower
Let's Define some Functions!
* Functions can be defined in Python using the "def" keyword in the form "def FunctionName(Variable)"
-- The variable listed in parentheses is the parameter that can be passed to the function when it is being called

Usage:


def myfunction(var1):
... print "Hello World!"

... print var1"

* This example function will print "Hello World" then print the value of the "var1" variable

* If we want to return a value to the code that called the function, we use "return variablename"

Get in Touch With Us!
* Subscribe and get Coding 101 automatically at TWiT.tv!
* Follow Pad

Comments

00:00