CSc 2010
Lab Assignment 4
Due: 25 March, 2010

There are two problems as before. The non-robot problem is an individual assignment and the robot problem is a team assignment.

  1. A non-robot problem (Should be submitted independently). Write a Pyhton program, called Scores.py, which reads a collection of exam scores (integers) ranging from 1 to 100 and counts and prints the number of `A' scores, `B' scores, `C' scores, `D' scores and `F' scores based on the following grading scale: A: 90 to 100; B: 80 to 89, C: 70 to 79, D: 60 to 69 and F: 1 to 59. The program should also print the number of scores, the average score, the maximum score, and the minimum score. A sample run of the program is shown below:
    >>> from Scores import *
    >>> main()
    Enter score (0 to stop): 63
    Enter score (0 to stop): 75
    Enter score (0 to stop): 72
    Enter score (0 to stop): 72
    Enter score (0 to stop): 78
    Enter score (0 to stop): 67
    Enter score (0 to stop): 80
    Enter score (0 to stop): 63
    Enter score (0 to stop): 75
    Enter score (0 to stop): 90
    Enter score (0 to stop): 89
    Enter score (0 to stop): 43
    Enter score (0 to stop): 59
    Enter score (0 to stop): 99
    Enter score (0 to stop): 82
    Enter score (0 to stop): 12
    Enter score (0 to stop): 100
    Enter score (0 to stop): 0
    
    Number of "A" scores = 3
    Number of "B" scores = 3
    Number of "C" scores = 5
    Number of "D" scores = 3
    Number of "F" scores = 3
    -------------------------
    Total Scores         = 17
    
    Average Score = 71.0
    Maximum Score = 100
    Minimum Score = 12
    

    You must implement the solution in two functions: main() and computeAnswers(L). The main() function prompts the user for the scores (one at a time, until the user enters 0) and populates a list of score. The computeAnswers(L) function examines scores in the list one at a time and performs the necessary computations to calculate the answers. It then puts all the answers in a list and returns that list.

  2. A robot problem (Done as a team with one submission per team).

    Purposes of Assignment

    1. Gain experience with robot sensors, including the camera and brightness sensors.
    2. Gain experience with lists.
    3. Learn how to write conditionals using if.
    4. Learn how to use return statement to return a value from a function.

    Description of Program

    You are to write a program named FindBrightest that takes a series of pictures using the robot camera and then determines which one of the pictures is of the brightest scene.

    To take the pictures, the program will use a loop similar to the one on page 102 in Kumar's book. After taking each picture, the program will display the picture in a window and cause the robot to turn left at half-speed for 0.2 seconds. The program will also capture the brightness reading for the center sensor.

    The loop will continue for 30 seconds. When the loop terminates, the program will search the list of brightness readings for the largest number (indicating the highest level of brightness). The program will then open a new window and use it to display the picture that corresponds to the largest brightness reading. The new window will have the title "Brightest" displayed at the top.

    You must put comments at the beginning of the program giving the program name, the names of your team members, the course number (CSc 2010), and the date.

    Program Submission

    Email your Scores.py and FindBrightest.py files to raj@cs.gsu.edu by 11:59 p.m. on the assigned date.