????????: As a programmer, you want to create a function to arrange the names of the actors and actresses based on their country. You will be given all the required information in a dictionary called my_dictionary which shall be passed as argument to the function call. Assume, the actors/actresses are either American, Korean or German (from 3 countries only). The names are further categorized under "Actors" and "Actresses". You are given the following dictionary where you have a nested dictionary containing a tuple. my_dictionary = {'American': {'Actors': ('Tom Cruise', 'Leonardo DiCaprio'), 'Actresses': ('Scarlett Johansson', 'Angelina Jolie')}, 'Korean': {'Actors': ('Lee in-ho', 'Song Joong-ki','Choi Jin-hyuk')}, 'German': {'Actors': ('David Kross', 'Michael Fassbender'), 'Actresses':('Diana Kruger')}} Write a python function that will take this dictionary as an argument in a function call which will convert this dictionary into the following tuple and return it. [Hint: You might need to use 3 nested loops.] Output tuple(You just have to print the resultant tuple.): (('Tom Cruise', 11010), ('Leonardo DiCaprio', 11017), ('Scarlett Johansson', 12018), ('Angelina Jolie', 12014), ('Lee in-ho', 21009), ('Song Joong-ki', 21013), ('Choi Jin-hyuk', 21013), ('David Kross', 31011), ('Michael Fassbender', 31018), ('Diana Kruger', 32012)) The output tuple consists of tuples as the elements. Each nested tuple has the name of the actor/actress (string) and an ID (integer) which is to be generated using the described process below. 1==> First Digit of the ID: 1a--> American is represented with 1 1b--> Korean is represented with 2 1c--> German is represented with 3 2==> Second digit of the ID represents type. Here 2a--> 1 means Actors 2b--> 2 means Actresses 3==>The last 3 digits of the Id is basically the length of the names of the actors/actresses including any spaces in between the names. For example, the length of the name “Tom Cruise” is 10 and so the last 3 digits are 010. For simplicity, you can consider that the length of the names of the actors/actresses will not be greater than 99. 4==> Do not worry about the uniqueness of these ids in the output. They do not have to be unique. Remember: Your code should work for all types of similar dictionaries if the sample dictionary is changed. note (using python )
????????:
As a programmer, you want to create a function to arrange the names of the
actors and actresses based on their country. You will be given all the
required information in a dictionary called my_dictionary which shall be
passed as argument to the function call. Assume, the actors/actresses are
either American, Korean or German (from 3 countries only). The names are
further categorized under "Actors" and "Actresses".
You are given the following dictionary where you have a nested dictionary
containing a tuple.
my_dictionary = {'American': {'Actors': ('Tom Cruise', 'Leonardo
DiCaprio'), 'Actresses': ('Scarlett Johansson', 'Angelina
Jolie')}, 'Korean': {'Actors': ('Lee in-ho', 'Song Joong-ki','Choi
Jin-hyuk')}, 'German': {'Actors': ('David Kross', 'Michael
Fassbender'), 'Actresses':('Diana Kruger')}}
Write a python function that will take this dictionary as an argument in a
function call which will convert this dictionary into the following tuple
and return it.
[Hint: You might need to use 3 nested loops.]
Output tuple(You just have to print the resultant tuple.):
(('Tom Cruise', 11010), ('Leonardo DiCaprio', 11017), ('Scarlett
Johansson', 12018), ('Angelina Jolie', 12014), ('Lee in-ho', 21009), ('Song
Joong-ki', 21013), ('Choi Jin-hyuk', 21013), ('David Kross', 31011),
('Michael Fassbender', 31018), ('Diana Kruger', 32012))
The output tuple consists of tuples as the elements. Each nested tuple has
the name of the actor/actress (string) and an ID (integer) which is to be
generated using the described process below.
1==> First Digit of the ID:
1a--> American is represented with 1
1b--> Korean is represented with 2
1c--> German is represented with 3
2==> Second digit of the ID represents type. Here
2a--> 1 means Actors
2b--> 2 means Actresses
3==>The last 3 digits of the Id is basically the length of the names of the
actors/actresses including any spaces in between the names. For example,
the length of the name “Tom Cruise” is 10 and so the last 3 digits are 010.
For simplicity, you can consider that the length of the names of the
actors/actresses will not be greater than 99.
4==> Do not worry about the uniqueness of these ids in the output. They do
not have to be unique.
Remember: Your code should work for all types of similar dictionaries if
the sample dictionary is changed.
note (using python )
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)