First Summer 2008


Lab Three: Very simple decisions.
The problems for today are two:

Write a program (call it grade.py)

  • that translates a number between 0 and 4
  • into the closest letter grade.

For example,

  • the number 2.8 (which might have been the average of several grades)
  • would be converted to B-.

Break ties in favor of the better grade; for example 2.85 should be a B.

Here's a sample run of such a program:
Enter numeric score then press Enter : 3.85
A

Enter numeric score then press Enter : 3.84
A-

Enter numeric score then press Enter : 3.5
A-

Enter numeric score then press Enter : 3.49
B+

Enter numeric score then press Enter : 3.1
B

Enter numeric score then press Enter : 10
Number out of range: number too big.

Enter numeric score then press Enter : -2
Number out of range: number too small.

Enter numeric score then press Enter : -0.5
Number out of range: number too small.
The second program:

Write a program that

State your assumptions in the code when you send it (more about this in class).


Last updated: May 08, 2008 by Adrian German for A201/A597