0

Write a program that translates the vowels of a given phrase to g

Write a program that translates the vowels of a given phrase to m Define a function to create a program that translates the vowels of a phrase. For example this is my cat Translation : thgs gs my cgt

8th Feb 2020, 3:05 PM
Walter
Walter - avatar
2 Respostas
0
Please try creating the program before asking for help. In case you need some hints, here are some that will help you: 📍Create a function that takes two parameters, the text and the replacement letter. 📍Create a new variable to contain the final string. 📍Use a for loop to go through each character in the provided string. You can use this to check if the character is a vowel: if char in "aeiou": #if char, or whatever you name the character in the for loop is part of "aeiou", it's a vowel 📍If it is a vowel, add it to the final string variable. Otherwise, add the replacement letter.
8th Feb 2020, 3:14 PM
Jianmin Chen
Jianmin Chen - avatar
0
def vowel_translator(string): translator = str.maketrans('aeiou', 'ggggg') return string.translate(translator)
9th Feb 2020, 4:22 PM
Princetronixx
Princetronixx - avatar