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
thumb_up100%
Complete the code below to correctly display all elements of the dictionary.
var contacts = ["Paul":"(657) 278-3821", "Yun": "(657) 278-2041", "Wenlin":"(657) 278-7151"]
for [ ] {
print("\(name): \(number)")
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps with 1 images
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
- 0 is an element {{0},{1}}?arrow_forwardCarefully study the code shown below. When run, this code could potentially produce at least 2 different errors. You should identify specifically the line number and location where each of these errors could occur and you should explain HOW and WHY it would occur. 1 def run_the_code(countries): ''' You can expect countries to be a dictionary with 0 or more string keys mapped to int values. ''' 4 if len(countries) > 20: print(countries['russia']) 6 for country in countries: elif countries[country] > 10000: print(country + 10000)arrow_forwardExercise: Check Monster Character Exists Description In this series of exercises, you will create functionsto create, modify and examine dictionaries thatrepresent characters in an animated film, and thecast members who voice the characters. Thekeys of the dictionary will be character names.The values in the dictionary will be voice actornames. For this exercise, you will create a function thatchecks if a character is already in the dictionary. Files • monsterfunctions.py : set of functions to work with monster cast dictionaries. Function Name has_character Parameters • monsters: a dictionary • character: a string, the name of a character Action Checks if character is a key in monsters. Return Value True if character is a key in monsters, otherwise False. Examples monsters = create_monster_cast()monsters = add_cast_member(monsters, "Mike", "William Crystal")has_character(monsters, "Mike") -> Truehas_character(monsters, "Sully") -> Falsearrow_forward
- Overview This program will welcome a user to the trivia builder 3000, then prompt the user to add questions to the trivia bank. After the user indicates they are done it will print out the contents of the trivia bank. Expected Output Example 1 Welcome to the trivia builder 3000 Enter the next question: Who was the fifth Beatle? Enter the correct answer for that question: Pete Best Enter the next question: You did not enter a question, let's try again. Enter the next question: How many dimples does a golf ball have Enter the correct answer for that question: 336 Enter the next question: Done We will stop entering questions now Here is the final trivia dictionary: The question is: Who was the fifth Beatle? And the answer is: Pete Best The question is: How many dimples does a golf ball have? And the answer is: 336 Example 2 Welcome to the trivia builder 3000 Enter the next question: What was the first name for the Beatles? Enter the correct answer for that question: The Quarymen Enter the…arrow_forward(1) Create two dictionaries: one should contain bank account number as key and the customer name as value. The other should contain bank account number as key and the balance as value. (1 pt) Ex:An account dictionary with one entry: {'109': 'John Doe'} A balance dictionary with one entry: {'109': 2500.58} Create the following 4 accounts:Account #: Name: Balance ($): '109' 'John 'Doe' 2500.58 '110' 'Mary Woods' 1070.50 '111' 'Sam Brown' 7850.00 '112' 'Mark Miller' 5000.95arrow_forwardWrite code that prints out the keys that have a value less than 3 in the following dictionary: d= {'a':5, 'is':3, 'this':2, 'program':1}arrow_forward
- # Using the routes dictionary defining places your airline can go with #with mileage to each, create a function that determines the total #distance travelled by going to the airports in sequence defined by this # list itinerary and the routes dictionary. (No published answer... def summary (routesMap) : # Please do not change any code below... airports = list (routesMap.keys ()) for airport in airports: destinations = routesMap [airport] for n in range (0,len (destinations)): destinationInfo = destinations [n] destination = destinationInfo [0] mileage = destinationInfo [1] print (f"Leaving {airport} to {destination} for (mileage} miles.") def distanceUsing (routesMap, itinerary): milesTravelled = 0 ### Your code goes here. return milesTravelled def main (): # Please do not change this dictionary... routes = { main () "Austin": "Chicago": "Dallas": "Denver": "El Paso": "Houston": "Nashville": summary (routes) [["Chicago", 500], ["Houston", 180], ["Nashville", 86011, [["Austin", 500],…arrow_forwardPlease in python, MUST use dictionaries This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team. (1) Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jersey numbers and the ratings in a dictionary. Output the dictionary's elements with the jersey numbers in ascending order (i.e., output the roster from smallest to largest jersey number). Hint: Dictionary keys can be stored in a sorted list. (3 pts)Ex: Enter player 1's jersey number: 84 Enter player 1's rating: 7 Enter player 2's jersey number: 23 Enter player 2's rating: 4 Enter player 3's jersey number: 4 Enter player 3's rating: 5 Enter player 4's jersey number: 30 Enter player 4's rating: 2 Enter player 5's jersey number: 66 Enter player 5's rating: 9 ROSTER Jersey number: 4, Rating: 5 Jersey number: 23, Rating: 4 Jersey number 30, Rating: 2 ... (2) Implement a menu of options for…arrow_forwardA Dictionary object’s Remove method returns an integer indicating the number of elements that were removed. Question 48 options: True Falsearrow_forward
- q2arrow_forwardWrite a function called count_duplicates that takes a dictionary as an argument and returns the number of values that appear two or more times.arrow_forwardJS Write a function named number_of_pairs whose parameter is an object/dictionary with strings as keys and integers as values. Your function should returns the number of key-value pairs in the parameter.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