Once you have all your answers let me know how many

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ne how many skittles of each color there are when There are five colors of skittles altogether: orange, green, purple, red, and yellow There are seven orange skittles There are three times as many green skittles as orange skittles There are as many purple skittles as orange and green skittles combined There are half as many red skittles as purple skittles There are 100 skittles all total. Skittles will have no input. Create variables to store the number of skittles of each color. One of those numbers is given to you. You should be able to find the others by performing simple arithmetic operations on the variables you've defined previously. Once you have all your answers, let me know how many skittles of each color there are by printing them out. (Functions skittles will not return a value, it will only print and then end.) (1b) Suppose I look back at my skittle tallies and discover to my chagrin that I had 6 orange skittles, not 7. In a comment below your code, explain how you would change your code to update all your skittle counts. (If this problem requires changing more than one line of code, you may want to reconsider how you compute those skittle counts in the first place.) (1c) Improve skittles (and avoid issues like 1b) by having skittles take two inputs, the total number of skittles and the number of orange skittles. (You will need to add parameters to the definition of the skittles function.) Test skittles by calling it for 6 orange skittles and 100 total skittles, and for 5 orange skittles and 50 total skittles: >>> skittles (100, 6) >>> skittles (50, 5) (2) Fancy Name Display Ever wanted to see your name in stars? For this part,...
View Full Document

This note was uploaded on 02/12/2014 for the course CIS 122 taught by Professor Staff during the Spring '08 term at University of Oregon.

Ask a homework question - tutors are online