Answered step by step
Verified Expert Solution
Link Copied!

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 9 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 value-returning function called convert_to_pig(word) 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 sub-string of the sentence to the function using the slice
operator [:]
In order to pass the correct sub-string, 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 sub-string 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, semi-colons, etc.)
Do not use lists for this assignment. If you use a list, you'll automatically lose 50% 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 week7 folder (created during the previous assignment), create a Python file called
ch9_ct_
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

Is this the best time to buy?

Answered: 1 week ago

Question

Discuss the legal framework of HRM in Canada.

Answered: 1 week ago