Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Write code that prints out the keys that have a value less than 3 in the following dictionary:
d= {'a':5, 'is':3, 'this':2, '
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- For this problem, you will write part of a Python program that will tell the user when to plant certain edible plants in their garden. The plants and their planting seasons are shown in the table below: Plant Season blueberry fall or spring tomato spring pumpkin late spring cabbage spring or late summer strawberry early spring Your code should: Store the plants words and their planting seasons in a dictionary Prompt the user to enter the name of a plant they want to look up. If the plant exists in the dictionary, print its planting season. Your program should be case insensitive e.g. both "cabbage" and "CABBAGE" should print "spring or late summer". If the word does not exist in the dictionary, print a message telling the user that you don't have the information they're looking for. Continue to prompt the user to enter a plant name to look up until they enter "q" to quit the program. Example input / output (User input in blue) Enter a plant name: Pumpkinlate…arrow_forwardPlease answer the Q1 in python with showing the codearrow_forwardThis is question 5 on the same chapter 9arrow_forward
- Code the following directions in python. 1.Assume the variable dct references a dictionary. Write an if statement that determines whether the key 'Jim' exists in the dictionary. If so, delete 'Jim' and its associated value. 2.Write code to create a set with the following integers as members: 10, 20, 30, and 40. 3.Assume each of the variables set1 and set2 references a set. Write code that creates another set containing all the elements of set1 and set2, and assigns the resulting set to the variable set3.arrow_forwardImplement the following: Given: person = {'name': 'bob'}1) Add the key/value pair 'emplStatus': 'Retired' to the dictionary person.2) Access the values in the dictionary person to print the following. Example OutputBob's employment status is Retired. NEED HELP WITH PYTHONarrow_forwardWrite a function named count_vowels that accepts a string as an argument. The function should count the number of times each vowel (the letters a, e, i, o, and u) appears in the string, and store those counts in a dictionary. When the function ends, the dictionary should have exactly 5 elements. In each element, the key will be a vowel (lowercase) and the value will be the number of times the vowel appears in the string.arrow_forward
- Write code that iterates through a dictionary represented by the variable my_dict and prints any values (not keys!) associated with keys beginning with the letter "k" (lowercase).arrow_forwardThis section has been set as optional by your instructor. OBJECTIVE: Write a program in Python that prints the middle value of a dictionary's values, using test_dict from the test_data.py module. NOTE: test_dict is created & imported from the module test_data.py into main.py Example 1: test dict = {'a':1,'b':9,'c':2,'d':5} prints 5 Example 2: test_dict = {'b':9,'d':5} prints 5 Hint: You may(or may not) find the following function useful: list.sort() which sorts the elements in a list. Note: the result is automatically stored in the original list, and return value from the function is None Туре list = [1, 2,3,2,1] After calling: list = [1,1,2,2,3] list.sort(), 339336.2266020 x3zgy7 LAB 13.11.1: Middlest Value (Structured Types) АCTIVITY 0/11 File is marked as read only Current file: test_data.py 1 #This module creates the test_dict to be used in main.py 2 #Reads input values from the user & places them into test_dict 3 dict_size = int(input()) #Stores the desired size of test_dict. 4…arrow_forwardNeed help answering this python question Create a dictionary of your friends that you found in 2017 and 2018. So, the keys are '2017' and '2018. For example: friend_solar = {2022: ["James", "Linda"] , 2023: ["Joshua", "Zoey"]} Print the friend's name Ask the user to enter a name of their friends. Then show the friend you found in 2022 or 2023. Ask the user to add a new friend name to the 2022 or 2023 lists (You need also to ask the user what year they want to add the friend name). Then add the entered friend name to the dictionary(2022 or 2023 value) Print the friends' dictionary on the screen.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education