Python Functions

From OpenCircuits
Jump to: navigation, search

Draft, really not ready

Functions are an important feature of almost any programming language. The basic idea is to take some code that you may want to reuse and package it for easy reuse. Often these are introduced as functions that help with math, but while common, they are not the majority. Here we will make a sill function based on text.

Our function will take 2 names and create a new name. by putting the first letter of the first name on the rest of the second name. Then we will print it. This is not a useful function, just an example.


# run me 
first    = "Joe"
second   = "Sue"
new      = first[0] + second
print new

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox