Lab : Creating Classes

In this lab we will create a class that will represent colors and build a function to combine two colors.

Background

RGB is a way of storing coloring data. R stands for red, G stands for green, and B stands for blue. Each color is given a value from 0 to 255.

You can use this tool to see what different colors are:http://www.rapidtables.com/web/color/RGB_Color.htm

https://media.24ways.org/2009/01/f1.gif

Lab

  1. Create a class, Color.
  2. Instantiate a few colors
  3. Add attributes of r, g, b to the instances
  4. Create a function, add_color, which takes in two colors and returns a color that is the average of the two reds, greens, and blues