У меня есть код, который превратит слово в латинский, я получаю пользовательский ввод от функции.Что мне нужно вставить в
print(convert_word(n))
, чтобы он печатался с пользовательским вводом?
def void(n):
n = input("Enter the word you want converted to Pig Latin: ")
return n
VOWELS = ('a', 'e', 'i', 'o', 'u')
# Function definition
def convert_word(word):
# Assign the first letter of word to variable first_letter
first_letter = word[0]
# Check if the word starts with a vowel
if first_letter in VOWELS:
# If it is a vowel, then keep the word as it is and add "hay" to the end
return word + "hay"
# If the word does not start with a vowel
else:
# Returns the word except word[0] and add "ay" at the end of the string
return word[1:] + word[0] + "ay"
# Prompt the user to enter the input string
# Call the function to convert the word to pigLatin
print(convert_word(n))