HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Quizzes
  2. /A price list is kept in a dictionary. The program changes one price, adds an item, and removes another. What does the program print?
Python ProgrammingMediumHigh School (9–10)Python Essentials › DictionariesPCEP (Python Institute)
StemPy LabCreated by StemPy Lab

A price list is kept in a dictionary. The program changes one price, adds an item, and removes another. prices = {"tea": 20, "bun": 15} prices["tea"] = 25 prices["jam"] = prices.get("bun", 0) + 5 del prices["bun"] print(list(prices.keys()), sum(prices.values())) What does the program print?

Log in to save
← All Quizzes
← A program keeps each letter of a word once, in a list, and then puts a star into the list. What does the program print?Each pair in a list holds a letter and how many times to repeat it. The pairs are unpacked in the loop header, and the word that comes out becomes a tuple. What does the program print? →
More onPython Essentials › Dictionaries

Discussion (0)

Log in to join the discussion.

Loading…

More questions on this topic

  1. A function adds up points for the letters of a word. Letters that are not in the dictionary get a…Medium
  2. A loop doubles every value of a dictionary, taking the keys in sorted order. Then the program…Hard
  3. A program should group words by their first letter, in a dictionary of lists. It stops with…Medium
  4. A theatre stores its seats in a dictionary. Each key is a tuple of a row number and a seat letter.…Medium
  5. A program counts the letters of a word in a dictionary, and then asks the dictionary three things.…Hard
All questions on this topic →

Problems on this topic

  1. Group these words by their length, in a dictionary where the key is the length and the value is the…Medium
  2. For this dictionary, write the expression for each answer…Medium
  3. Write a program that counts how many times each letter appears in the word mississippi, and shows…Easy
  4. Say whether a list or a dictionary is the better choice for each, and why…Easy
All problems on this topic →