Answered step by step
Verified Expert Solution
Question
1 Approved Answer
RAO Chapter 9 CT Exercise Prompt the user to enter a sentence to be converted. For each word in the sentence, convert it to the
RAO Chapter CT Exercise Prompt the user to enter a sentence to be converted.
For each word in the sentence, convert it to the corresponding pig Latin version.
create a valuereturning function called converttopigword that takes the English
word as a parameter, and returns the pig Latin version.
Until we learn about lists, you'll need to do this the hard way. TIPS:
You'll need to pass a substring of the sentence to the function using the slice
operator :
In order to pass the correct substring, you'll need to iterate through the string using
an index and check to see if the character at the current index is a space or the end
punctuation
You'll need to keep track of where the start of your substring is and the end will be
what your current index is if the character is a space or the end punctuation.
This flow chart may help you it does not contain all the required steps:
To keep things simple, assume the sentence the user enters contains an ending
punctuation and no other symbols commas semicolons, etc.
Do not use lists for this assignment. If you use a list, you'll automatically lose credit.
Output the full sentence to the user with correct capitalization and use the same punctuation.
Output Example:Your sentence in Pig Latin is:
In this assignment you are going to create a simplified pig Latin generator. It will follow the
following rules:
The first letter will be placed at the end of the word and add ay
ex: 'that' 'hattay'
If the work starts with a vowel just add ay to the end
ex 'owl' 'owlay'
You'll need to use functions, selection statements, iteration, and the accumulator pattern to
accomplish this task correctly.
Setup:
In your week folder created during the previous assignment create a Python file called
chct
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started