Course Home | Homework | Lab Hours | Programming | Schedule & Lecture Notes | Submit

Saint Louis University

Computer Science 150
Introduction to Computer Science

Michael Goldwasser

Fall 2005

Dept. of Math & Computer Science

Homework Assignment 04b

Flow of control

Contents:


Overview

Topic: Flow of Control
Related Reading: Zelle 2.6, Ch. 7, 8.4
Due: 1:10pm, Tuesday 4 October 2005

Please make sure you adhere to the policies on academic integrity.


Problems to be Submitted (20 points)

For both of these problems, you could always type in the specified code fragments and let Python answer the questions for you, however you are strongly advised to first attempt these problems by hand! (as these are the type of problems which might be seen on an exam)

  1. (4 points)

    Zelle's Chapter 2, "Discussion" question 4 (page 48)

  2. (6 points)

    Zelle's Chapter 7, "Discussion" question 2 (pages 227-228)


Extra Credit

  1. (2 points)

    Write a code fragment which takes a list items and prints out all values which occur more than once on the list. Take care to only print out each such value once.

    For example, given the list:

          items = ['apple','grapes','kiwi','kiwi','pear','grapes','kiwi', 'strawberry']
          
    Your program should print:
          grape
          kiwi
          
    (or kiwi, grape; the order is up to you).


Michael Goldwasser
CSCI 150, Fall 2005
Last modified: Wednesday, 05 October 2005
Course Home | Homework | Lab Hours | Programming | Schedule & Lecture Notes | Submit