CPSC 230 Assignment 5: The Joy of Strings solution

$30.00

Category:

Description

5/5 - (5 votes)

Reading
This assignment assumes you have read Chapter 4. Next up is Chapter 5 (functions), which
should be read prior to the next class.
Overview
Do you know what an alternade is? Of course you don’t, no one does! According to
Wikipedia, an alternade:
“is a word in which its letters, taken alternatively in a strict sequence, and used in the same
order as the original word, make up at least two other words. All letters must be used, but
the smaller words are not necessarily of the same length. For example, a word with seven
letters where every second letter is used will produce a four-letter word and a three-letter
word.”
In most cases, the alternade is formed by looking at letters that are two spaces apart, with
the first word starting at position 0, and the second from position 1. For example, the word
“pained” is an alternade, because using the rules above we produce 2 words: “pie” and
“and”
Your job is to write a Python program that asks the user to make one of two
choices…destruct or construct.
If the user chooses destruct, prompt them for an alternade, and then output the 2 words
from that alternade.
If the user chooses construct, prompt them for 2 words, and then output the alternade that
would have produced those words.
You must enforce that the users enter real words…or at least not blatant non-words. So if
their input contains numbers, whitespace, punctuation, etc., you should prompt them for
input until correct input is provided.
**You can assume the word entered is of even length, but if you want a challenge, figure out
how to implement if the length of the word is even or odd.**
If you manage to get all that done, then implement the following: the words output by your
program must be in alternating case, starting with uppercase. So, for example, if you
wanted to output the word “happy”, it should be displayed as “HaPpY.”
You may work in groups of 2-3.
Due Date
This assignment is due on 3-20-2020. Submit via Canvas. It should be labeled
firstinitiallastname_Assignment5. Please make sure to include all the required files
(README, source files). Make sure to note who you worked with.
Grading
Your program will be evaluated for correctness and elegance. In particular, you should
make sure your code is properly commented and obeys standard naming conventions.