Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: How can I print the number of unique elements in a list?
Post: RE: How can I print the number of unique elements ...

I'm sorry for the mixup. Below is the code I've written that should have been in my OP (the incorrect code is from another problem). def number_of_item_types(d): return (len(d['items']))Thank yo...
AnOddGirl Homework 5 3,293 Mar-24-2020, 05:47 AM
    Thread: How can I print the number of unique elements in a list?
Post: How can I print the number of unique elements in a...

Using the dictionary below, I'm supposed to create a function that returns the number of unique items in the "items" list. shopping_cart = { "tax": .08, "items": [ { "tit...
AnOddGirl Homework 5 3,293 Mar-19-2020, 10:53 PM
    Thread: Need help comparing totals from list of dictionaries
Post: RE: Need help comparing totals from list of dictio...

Figured it out in case anyone ever needs to know. def most_spent_on_item(d): NewDict={"title": "0 ", "price": 0, "quantity": 0} RunningHighestTotal=0 for i in d['items'...
AnOddGirl Homework 1 1,558 Mar-18-2020, 01:17 AM
    Thread: Need help comparing totals from list of dictionaries
Post: Need help comparing totals from list of dictionari...

I need to write a code that will multiply the price of each item with its respective quantity and then return whichever dictionary has the highest total. In this case, Chocolate should be returned sin...
AnOddGirl Homework 1 1,558 Mar-17-2020, 11:43 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020