Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This is a dictionary comprehension
- # We'll see an example after this assignment!
- euro_data = {
- item_id: [name, price, category, sizes]
- for item_id, name, price, category, sizes in zip(
- item_ids_list, item_names_list, euro_prices_list, item_category_list, sizes_list
- )
- }
- euro_data
- ''' 2 Calculate the Total Cost of Items
- Calculate the amount it would cost to purchase all the items in euro_data.
- Use a list comprehension to collect them into a list. '''
- sum([euro_data[key][1] for key, value in euro_data.items()])
- # new_list = [expression for member in other_iterable (if condition)]
- # new_dict = {key: value for key, value in other_iterable (if condition)}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement