Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use python to solve this question please! This lab exercise provides practice with strings and functions in Python. You will work with a partner on

image text in transcribed

Use python to solve this question please!

This lab exercise provides practice with strings and functions in Python. You will work with a partner on this exercise during your lab session. Two people should work at one computer. Occasionally switch the person who is typing. Talk to each other about what you are doing and why so that both of you understand each step Programming with Strings Develop a Python program which will convert English words into their Pig Latin form, as described below The program will repeatedly prompt the user to enter a word. First convert the word to lower case. The word will be converted to Pig Latin using the following rules a) If the word begins with a vowel, append "way" to the end of the word. b) If the word begins with a consonant, remove all consonants from the beginning of the word and append them to the end of the word. Then, append "ay" to the end of the word. For example "dog" becomes "ogday" "scratch" becomes"atchscray" "is" becomes "isway" apple" becomes "applewaY "Hello" becomes "ellohay" "a" becomes "away" The program will halt when the user enters "quit" (any combination of lower and upper case letters, such as "QUIT", "Quit" or "qUIt") Suggestions a) Use .lower to change the word to lower case b) How do you find the position of the first vowel? I like using enumerate (word) as in for i,ch in enumerate (word) where ch is each character in the word and i is the character's index (position) c) Use slicing to isolate the first letter of each word. d) Use slicing and concatenation to form the equivalent Pig Latin words e) Use the in operator and the string "aeiou" to test for vowels Good practice: define a constant VOWELS -"aeiou

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_2

Step: 3

blur-text-image_3

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

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions

Question

3. How would this philosophy fit in your organization?

Answered: 1 week ago

Question

3. What information do participants need?

Answered: 1 week ago