CPSC 230: Computer Science I Programming Assignment 6 solution

$30.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (3 votes)

Overview Implement the following problems as self-contained python modules.
YOU ARE NOT ALLOWED TO USE A DICTIONARY.
1. Write a module, complement.py, with a function, complement, that returns the
complement of a DNA string. Also provide a function, rev_complement that takes a
DNA sequence as string input and returns the reverse complement of the sequence as
a string. Recall that the valid alphabet is {A, C, T, G} and that A-T and G-C are
complements. A reverse complement is found by reversing the input string and
replacing every nucleotide with its complement. This means that your rev_complement
function should use your complement function internally rather than duplicating code.
Your functions should do appropriate error checking and return an error message as
appropriate. Test your functions with input from the user.
For example, if your input is ACTG, your complement should be TGAC and your
reverse complement should be CAGT.
2. Write a module, latin.py, with two functions word_to_pig and name_to_pig. Your
word_to_pig function will take 1 parameter that converts the word based on the below
rules. Your name_to_pig function takes 2 input parameters, first_name and
last_name, and will use your word_to_pig function to do the translation to avoid
duplicating code. Your name_to_pig function returns the names in pig Latin. Test your
functions with input from the user, you only need test a name, not a word and then
a name.
Please use the following guidelines for Pig
Latin:
● Words beginning with consonants: move the consonant from the start of the
word to the end of the word. Then add the suffix “ay” to the end of the word. For
example, the word “hello” would become ellohay, the word “duck” would become
uckday.
o For a bonus, remove all consonants from the start of the word to the end
of
the word and then add the suffix “ay” to the end. For example,
“Chapman” becomes Apmanchay.
● Words beginning with vowels: all you need to do is add “yay” to the end of the
word. You don’t need to change any letters around, just say the word as normal then
add “yay” to the end. For example: the word “egg” becomes eggyay and the word
“ultimate” becomes ultimateyay.
Make sure to use your string methods so you have capital letters where appropriate
and not otherwise. Test your functions with input from the user. Assume the user
enters his/her name with capitals for both their first and last name.
i.e. – Elizabeth Stevens become Elizabethyay Tevenssay (bonus – Evensstay)
Due Date
This assignment is due at 11:59 pm on 4-3-2020. Submit via Canvas; create a zip file
with all your files in it. It should be labeled firstinitiallastname_Assignment6. Please
make sure to include all the required files (README, source files).
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.