CS 111

Fall 2016

Introduction to Computer Science

HW05: Menu-driven string functions

Due: Friday, 09/30 at 23:55

If you are pair programming, do NOT start coding without your partner. You should read the assignment first, feel free to think about it, but do not actually start coding.

The program

For this assignment, you'll get the opportunity to apply your knowledge of loops, conditionals, and functions to create a small menu-driven program that will enable your user to play with strings. You may wish to use some of Python string methods.

When a person executes your program, your program should ask the person to enter a string. Next, the following menu should appear:

A. How many characters are in the string? B. How many letters are in the string? C. How many vowels are in the string? D. Is the string a palindrome? E. What is the Caesar Cipher (shift 3) of the string? Q. Quit Your choice:

Once the person makes a choice, the program should perform the requested task. If the person chooses Q, then the program should terminate. Otherwise, the process should continue—ask the user for another string, print the menu, get a choice, etc.

For the purposes of this assignment, you may assume that a string is a palindrome only if it is exactly the reverse of itself. Thus, "rats live on no evil star" will be a palindrome, but "sit on a potato pan, Otis." will not. (If you wish to write a more sophisticated palindrome tester that ignores punctuation, capitalization, and spacing, feel free to do so.)

Also, let's pretend that the letter y is never a vowel.

To get started, save and run this program: menu.py. This program illustrates a simple menu-and-response structure that you can adapt for this assignment.

Start early, have fun, and ask questions.