Course Home | Class Schedule | Assignments | Git Submission | Perusall | Python | Tutoring

Saint Louis University

Computer Science 1300/5001
Introduction to Object-Oriented Programming

Michael Goldwasser

Fall 2018

Computer Science Department

Homework Assignment 05

Strings and Lists

Overview

Topic: Strings and Lists
Related Reading: Revised Chapter 6
Due: 10:00am, Tuesday 18 September 2018

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


Problems to be Submitted (20 points)

  1. (10 points)

    Write a program that accepts a sentence from the user on a single line, and which outputs the number of words in the sentence. A sample execution appears as follows:
    Enter a sentence: The quick brown fox jumps over the lazy dog
    You entered 9 words.

  2. (10 points)

    Write a program that prompts the user for a name that is assumed to be of form FirstName MiddleName LastName and which echos the name except with the middle name replaced by the middle initial and a period.

    The precise format should match the following sample session.

    What is your name? Elmer James Fudd
    Elmer J. Fudd


Michael Goldwasser
CSCI 1300/5001, Fall 2018
Last modified: Sunday, 16 September 2018
Course Home | Class Schedule | Assignments | Git Submission | Perusall | Python | Tutoring