May 22nd 2014
Coding 101 18
Python: Defining Functions
Hosted by
Fr. Robert Ballecer, SJ,
Shannon Morse
We close out Python with functions.
Although the show is no longer in production, you can enjoy episodes from the TWiT Archives.
Guests:
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 https://twit.tv/shows/coding-101.
- Follow PadreSJ and Snubs on Twitter
Bandwidth for Coding 101 is provided by CacheFly.