Computer Science 112
The Art & Science of Computer Graphics

Fall 2015, The College of Saint Rose

Lecture 21: Functions
Date: Friday, November 13, 2015


Agenda

Lecture 21 Assignment

Due at the start of class, Wednesday, November 18.

Please submit answers to these questions either as a hard copy (typeset or handwritten are OK) or by email to terescoj AT strose.edu by the start of class. Please use a clear subject line when submitting by email (e.g., CSC 112 Lecture 21 Assignment , Joe Student). We will discuss these questions at the start of class, so no late submissions are accepted.

We revisit questions from the previous lecture assignment, now working with Python functions.

  1. Turn the Python statements that create a "plastic" material whose color is a randomly chosen shade of gray into a function named randomGrayPlastic that returns such a material. (5 points)
  2. Place the Python loop that prints out 5 random numbers in the range 1 through 6 into a Python function called yahtzeeRoll that prints out the 5 values, but also returns their sum. (5 points)
  3. Write a Python function that takes one parameter: a number, let's call it n, and then uses a loop to generates n random integers in the range 0-100 and returns their sum. (5 points)

Terminology

Examples