TGViewer
PyNotes PyNotes @py_notes_uz · 207 subscribers
Post #78 287
#dicts

Title: Calculating dicts
prices = {
'ACME': 45.23,
'AAPL': 612.78,
'IBM': 205.55,
'HPQ': 37.20,
'FB': 10.75
}
Get min from dict:
min_price = min(zip(prices.values(), prices.keys())) 
# min_price is (10.75, 'FB')

Get max from dict

max_price = max(zip(prices.values(), prices.keys())) 
# max_price is (612.78, 'AAPL')


Sort Dict:
prices_sorted = sorted(zip(prices.values(), prices.keys()))

📌 be aware that zip() creates an iterator that can only be consumed once. If you call zip variable next time, it will return empty obj.
More from @py_notes_uz
  1. Oct 13, 2026📢 Ertaga meetup qilyapman Ertaga, 14-oktabr kuni INHA universitetida meetup o'tkazaman. T…
  2. Sep 10, 2026👋 Accepted AI Men sizga orzuingizdagi ishga qabul qilinishda yordam beraman: 📊 CV'ingizn…
  3. May 5, 2026Middle/Senior Full Stack (Python+TypeScript) | Sigma Software Qualifications • 6+ years of…
  4. Apr 16, 2026🇺🇿 o'zbek tilida 🇷🇺 на русском AI Incubator 2026 — Applications Open 🚀 Launch your AI…
  5. Mar 24, 2026Want to learn how AI agents are built at Yandex? The Yandex School of Data Analysis is run…
  6. Feb 17, 2026💡 Python bo'yicha ko'nikmalaringizni sanoat standartlari darajasiga oshirishni va mutaxas…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →