In Q3, you wrote code that would modify your name, replacing vowels with the corresponding character defined in new_language . Here, define a function called modify_string that will accomplish the same task as in Q3, taking a string as input and return ing the modified string from the function. This function should have a single parameter: input_string - the string to be modified. I # YOUR CODE HERE

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Use Python

In Q3, you wrote code that would modify your name, replacing vowels with the corresponding
character defined in new_language .
Here, define a function called modify_string that will accomplish the same task as in Q3,
taking a string as input and return ing the modified string from the function.
This function should have a single parameter: input_string - the string to be modified.
I # YOUR CODE HERE
Transcribed Image Text:In Q3, you wrote code that would modify your name, replacing vowels with the corresponding character defined in new_language . Here, define a function called modify_string that will accomplish the same task as in Q3, taking a string as input and return ing the modified string from the function. This function should have a single parameter: input_string - the string to be modified. I # YOUR CODE HERE
Q3
Store your first name as a string in the variable my_name .
In this question, you're going to change my_name using the key-value pairs in new_language
(defined below), ultimately storing the updated name in modified_name . Specifically, if any of
the letters in your name ( my_name ) are keys in the dictionary new_language below, use that
key's value in that letter's place
modified_name . If the letter is not in new_language , add the
original character from my_name to modified_name .
For example, if my_name stored 'Shannon', modified_name would store 'Shännön' (the a and
the o have the modified character from new_language )
Note that if your name does not have any vowels in it, the code should still run, but the string
stored in modified_name will be the same as the string in my_name . In other words, your code
should accomplish the specified task, regardless of what name is stored in my_name .
I # run this to create list
{'a': 'ä',
'e' :
new_language
%3D
'i'
:
'o' :
'ð',
'u' : 'û',
'A' : 'Ä',
'E' : 'ɛ',
'O' : 'Ó',
'U' : 'Ü'}
I # YOUR CODE HERE
my_name =
'Bethany'
for key, value in new_language.items(():
modified_name
modified_name.replace(key, value)
print(modified_name)
Bəthäny
Transcribed Image Text:Q3 Store your first name as a string in the variable my_name . In this question, you're going to change my_name using the key-value pairs in new_language (defined below), ultimately storing the updated name in modified_name . Specifically, if any of the letters in your name ( my_name ) are keys in the dictionary new_language below, use that key's value in that letter's place modified_name . If the letter is not in new_language , add the original character from my_name to modified_name . For example, if my_name stored 'Shannon', modified_name would store 'Shännön' (the a and the o have the modified character from new_language ) Note that if your name does not have any vowels in it, the code should still run, but the string stored in modified_name will be the same as the string in my_name . In other words, your code should accomplish the specified task, regardless of what name is stored in my_name . I # run this to create list {'a': 'ä', 'e' : new_language %3D 'i' : 'o' : 'ð', 'u' : 'û', 'A' : 'Ä', 'E' : 'ɛ', 'O' : 'Ó', 'U' : 'Ü'} I # YOUR CODE HERE my_name = 'Bethany' for key, value in new_language.items((): modified_name modified_name.replace(key, value) print(modified_name) Bəthäny
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education