Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function that generates postcards as strings only for prices strictly lower than 100 . The output must be a dictionary with names as
Write a function that generates postcards as strings only for prices strictly lower than 100. The output must be a dictionary with names as keys and postcards as their corresponding values. Postcards have the following components, all in lowercase:
The first four letters of the persons first name, if not enough, take all
The age
The persons full last name
The last digit of the price
The place
1. You can assume that there won't be any duplicate names in the inputs as it could cause issues with duplicate keys in the output dictionary. 2. You can create a dictionary using dict( ) without a loop if you have a list of length-2 tuples, one for key and another for value. 3. The zip() function might be useful when creating the list of tuples above. 4. You may want to implement the function using for/while loops and/or list comprehension for extra practice def personalized_postcards(team): "I" > personalized_postcards ([ ... ('Yue Wang', 96, 18, 'Hoover Dam'), ... ('Cleo Patra', 10, 32, 'Bellagios') (..] ]) \{'Yue Wang': 'yue18wang6hoover dam', 'Cleo Patra': 'cleo32patraobellagios' } > personalized_postcards ([]) \{\} > personalized_postcards ([ ... ('Mari Noh', 155, 18, 'tram'), ... ('Gwen Am', 34, 54, 'Venetian'), ... ('Freya Dog', 34, 1, 'The Strip') (..] \{'Gwen Am': 'gwen54am4venetian', 'Freya Dog': 'freyldog4the strip'\} "IIStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started