Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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'\} "II

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Climate And Environmental Database Systems

Authors: Michael Lautenschlager ,Manfred Reinke

1st Edition

1461368332, 978-1461368335

More Books

Students also viewed these Databases questions