Anne Dawson: CSCI120A_LAB7_FA04.htm   

 

Last updated: Wednesday 3rd November 2004, 8:24 PT

 

This document is subject to change without notice.

 

Please report any errors or omissions in this document:

adawson@coquitlamcollege.com

 

Special instructions:  For this assignment you may work in teams of 2, or alone.  This lab is due at the end of the lab session.

 

 

CSCI120A

 

Introduction to Computer Science and Programming

Fall 2004

Lab Assignment 7

String Analysis

Step 1

 

Study the following program requirements (program specification).  You are to write a string analysis program.  Your program prompts the user to enter a string of any length. The program then outputs:

 

1.      the number of characters in the string

2.      how many of the characters are upper case

3.      how many of the characters are lower case

4.      how many alphabetic characters (A-Z, a-z) there are

5.      how many numeric characters (0-9) there are

6.      the number of words in the string (for bonus points)

              (A word is defined as a group of one or more characters

                bounded by a space or punctuation mark on either side.)

      7.   The program should repeat at the user's request.

 

Note: For this lab you do not need to supply an algorithm and pseudocode.

 

Start your program with a comment block that contains the following information:

 

#  File:       lab7.py

#  Purpose:    String analysis

#  Programmer: [your name]   

#  Partner:    [your partner's name]

#  Course:     CSCI120A

#  Date:       Wednesday 3rd November 2004

 

Step 2

 

Test your program by supplying your own test data. You should test your program with at least 3 sets of test data. Show your test data and results in comments at the top of your program.

 

Step 3

 

At the end of the class, save your program file (lab7.py) to your folder on the network in:

 

CSCI120A\Week09\Lab07

 

 

Program points will be based on the following marking scheme:

 

Marking Scheme: CSCI120A   -   Lab 7  -  String Analysis

Student name(s):

Category

Points

Description

Style

30

The program is user-friendly. The source code is commented appropriately, with test data. The program has meaningful variable names (identifiers). The program is easy to follow.

Part 1

10

as per specification

Part 2

10

as per specification

Part 3

10

as per specification

Part 4

10

as per specification

Part 5

10

as per specification

Part 7

10

as per specification

Test

10

Comments in the code explain how the code was tested.

Bonus (Part 6)

10

as per specification

 

 

Assignment Presentations :  In the next class, a random selection of lab assignment programs will be presented to the CSCI120A group.