Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that inputs two string variables, first and last, each of which

ID: 3775398 • Letter: W

Question

Write a program that inputs two string variables, first and last, each of which the user should enter with his or her name. First, convert both strings to all lowercase. Your program should then create a new string that contains the full name in pig latin with the first letter capitalized for the first and last name The rules to convert a word into pig latin are as follows: If the first letter is a consonant move it to the end and add "ay" to the end. If the first letter is a vowel, add "way" to the end. For example, if the user inputs "Erin" for the first name and "Jones" for the last name, then the program should create a new string with the text "Erinway Onesjay" and print it

Explanation / Answer

def convert(name):
vowels = ['a','e','i','o','u']
# convert all characters to lower case
name = name.lower()
# check vowel
if(name[0] in vowels):
    name = name + "way"
else:
    name = name[1:] + name[0] + "ay"
# convert first letter to upper case
name = name[0].upper() + name[1:]
return name
firstName = raw_input("Enter firstName:")
lastName = raw_input("Enter lastName:")
# add firstName and lastName
name = convert(firstName) + " " + convert(lastName)
print name

"""
sample output
Enter firstName: Erin
Enter lastName: Jones
Erinway Onesjay
"""

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote