Question: Q5: In Q3, you wrote code that would modify your name, replacing vowels with the corresponding character defined innew_language. Here, define a function calledmodify_stringthat will
Q5: In Q3, you wrote code that would modify your name, replacing vowels with the corresponding character defined innew_language.
Here, define a function calledmodify_stringthat will accomplish the same task as in Q3, taking a string as input andreturning the modified string from the function.
This function should have a single parameter:input_string- the string to be modified.
Question 3 was this (for context):
Store your first name as a string in the variablemy_name.
In this question, you're going to changemy_nameusing the key-value pairs innew_language(defined below), ultimately storing the updated name inmodified_name. Specifically, if any of the letters in your name (my_name) are keys in the dictionarynew_languagebelow, use that key's value in that letter's place inmodified_name. If the letter is not innew_language, add the original character frommy_nametomodified_name.
For example, ifmy_namestored 'Shannon',modified_namewould store 'Shnnn' (the a and the o have the modified character fromnew_language)
Note that if your name does not have any vowels in it, the code should still run, but the string stored inmodified_namewill be the same as the string inmy_name. In other words, your code should accomplish the specified task, regardless of what name is stored inmy_name.
new_language = {'a': '',
'e' : '',
'i' : '',
'o' : '',
'u' : '',
'A' : '',
'E' : '',
'O' : '',
'U' : ''}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
