Lecture notes for the Introduction to Computer Science I by James Tam Return to the course web page

Example Programs: Functions Part II

Description

Program name

A program that calculates simple interest, similar to the previous version but now it returns values back to the caller. interest.py
An example of a boolean function that determines which grade level that the user falls under. grade_category.py
Introduces the use of global variables, reads the contents of a global. global_example1.py
A program that tries to write a global variable but instead it creates a local copy. global_example2.py
Revised version of the previous program, introduces the keyword 'global' global_example3.py