Correct the syntax errors to allow the code to pass all of the provided doctests.
def igpay_atinlay(word):
#preserve first letter capitalization
upper = word[0].isupper()
#convert to lower and check vowel
if word[0].lower() in 'aeiouy':
word = word + 'way'
else:
#move letters to last untill first vowel
while word[0] not in
'aeiouy':
word = word[1:]
+ word[0]
word = word + 'ay'
# if given first letter capital return word with first
letter capitalized
if(upper):
return word.title()
else:
return word
print(igpay_atinlay("Pig"))
#Igpay
print(igpay_atinlay("Latin"))
#Atinlay
print(igpay_atinlay("me"))
#emay
print(igpay_atinlay("egg"))
#eggway
print(igpay_atinlay("Shoot"))
#Ootshay
print(igpay_atinlay("Spy"))
#Yspay
print(igpay_atinlay("Amy"))
#Amyway
print(igpay_atinlay("twyndyllyng"))
#yndyllyngtway
Correct the syntax errors to allow the code to pass all of the provided doctests. You...
In java: A fun language: f you recently ate at Chipotle, you may have received a brown paper bag with gibberish letters written on it: “AKINGMAY AWAY IGPAY EALDAY ABOUTWAY IGPAY ATINLAY”. In fact this message is written in Piglatin, a simple but fictitious language. Piglatin converts a word in English using the following two rules: If the letter begins with a vowel, then “WAY” is appended to the word. If the letter begins with a consonant (a letter other...
**IN JAVAAssignment 10.1 [95 points]The WordCruncher classWrite the Java code for the class WordCruncher. Include the following members:A default constructor that sets the instance variable 'word' to the string "default".A parameterized constructor that accepts one String object as a parameter and stores it in the instance variable. The String must consist only of letters: no whitespace, digits, or punctuation. If the String parameter does not consist only of letters, set the instance variable to "default" instead. (This restriction will make...
Design and code a SWING GUI to translate text entered in English into Pig Latin. You can assume that the sentence contains no punctuation. The rules for Pig Latin are as follows: For words that begin with consonants, move the leading consonant to the end of the word and add “ay”. Thus, “ball” becomes “allbay”; “button” becomes “uttonbay”; and so forth. For words that begin with vowels, add “way’ to the end of the word. Thus, “all” becomes “allway”; “one”...
I have this problem for a final thats in my book thats i'm stuck on . Any help would be really appreciated. Design and code a Swing GUI to translate text that is input in English into Pig Latin. You can assume that the sentence contains no punctuation. The rules for Pig Latin are as follows: ⦁ For words that begin with consonants, move the leading consonant to the end of the word and add “ay.” For example, “ball” becomes...
For this week's lab, you will use two of the classes in the Java Collection Framework: HashSet and TreeSet. You will use these classes to implement a spell checker. Set Methods For this lab, you will need to use some of the methods that are defined in the Set interface. Recall that if set is a Set, then the following methods are defined: set.size() -- Returns the number of items in the set. set.add(item) -- Adds the item to the...
For this week's lab, you will use two of the classes in the Java Collection Framework: HashSet and TreeSet. You will use these classes to implement a spell checker. Set Methods For this lab, you will need to use some of the methods that are defined in the Set interface. Recall that if set is a Set, then the following methods are defined: set.size() -- Returns the number of items in the set. set.add(item) -- Adds the item to the...
CSC110
Lab 6 (ALL CODING IN JAVA)
Problem: A text file contains a paragraph. You are to read the
contents of the file, store the UNIQUEwords and count the
occurrences of each unique word. When the file is completely read,
write the words and the number of occurrences to a text file. The
output should be the words in ALPHABETICAL order along with the
number of times they occur and the number of syllables. Then write
the following statistics to...