Question: Correct the syntax errors to allow the code to pass all of the provided doctests. You may have heard of Pig Latin, a set of

Correct the syntax errors to allow the code to pass all of the provided doctests.

 Correct the syntax errors to allow the code to pass all

You may have heard of "Pig Latin," a set of rules for modifying regular English to render it unintelligible to those who do not know the rules. This problem asks you to fix a function that will convert an English word to Pig Latin The rules for converting a word to Pig Latin are as follows: 1. If the word starts with a vowel, add "way" to the end of the word 2. Otherwise, all letters before the first vowel of the word are moved to the end of the word and "ay" is added to the end Write a function named igpay_atinlay ) that takes a single parameter, a string containing an English word, and returns the string's Pig Latin translation in accordance with the rules above. For this problem, assume the letter "Y is always a vowel. Your solution should also preserve the word's capitalization. You may assume that the only letter that might be capitalized is the first letter of the word and that the word will only contain alphabetic letters-no digits, spaces, punctuation marks, or other special characters Your friend wrote the code below, but can't seem to get it to pass all of the doctests. Python runs the code without problem, so they're pretty sure that there aren't any syntax errors. Help them correct their errors and make the code pass all of the provided doctests def igpay_atinlay (word): >>>igpay_atinlay ("Pig") Igpay >>>igpay_atinlay ("Latin") Atinlay >>>igpay_atinlay("me") emay >>>igpay_atinlay("egg") eggway >>>igpay_atinlay("Shoot") Ootshay >>>igpay_atinlay("Spy") Yspay >>igpay atinlay("Amy") Amyway >>>igpay atinlay ("twyndyllyng" yndyllyngtway import string if word [1] in 'aeiouy return word +'way while word[O] not in 'aeiouy: return word + 'ay' else: word = word [ 1 : ] + word [ 0]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!