Class 41 April 27

I know that


Always look both ways


Agenda


Test accommodations


Module leap_year.py

  • Returns True or False depending whether y is a leap year. A year is a leap year, if it is evenly divisible by 4 and not evenly divisible by 100. Also, a year is a leap year, if it is evenly divisible by 400. All other years are not leap years.
  • Returns a 12-element list giving the numbers of days in each month for year y.
  • Returns the day of the year, where the year is y, the month is m, and the day of the month is d. For example, 1/1/2017 is the 1st day of the year, 12/7/2017 is the 341st of the year, and 3/1/20

Module dictionary.py

  • If the lengths of k and v are not equal, the function returns None. Otherwise, the function returns a new dict. In this dictionary, the i th element of k maps to the i th element of v.
  • Returns True or False depending whether there are no duplicates in d.

Module shifty.py

  • Returns an integer based on integer v. If v is negative, the function returns 0. If instead v exceeds 255, the function returns 255. Otherwise, the function returns v. Thus, the return value is always a legal value for an individual RGB level.
  • Returns the new color ( legal( nr ), legal( ng ), legal( nb ) ), where nr, ng, and nb are the values gotten by legally decrementing the RGB values of pixel respectively by the amounts x, y, and z.
  • Returns a new image that is based on original, where a pixel in the new image is obtained by using offset() on the corresponding pixel in original with offset amounts x, y, and z.

Module marbles.py

  • Returns True if n equals 1; otherwise, returns False.
  • Returns the number of marbles the computer takes for its move. The amount is randomly chosen from the inclusive range 1 through n / / 2.
  • If m is a legal amount to take, the function returns True; otherwise, the function returns False.
  • If m is a legal amount to take, the function returns m; otherwise, the function returns 0.

 



Warning: fopen(/l/cs1112/public_html/defs/htm/181-trailer): Failed to open stream: No such file or directory in /l/cs1112/public_html/defs/php/read.php on line 5
Unable to open file!