Starting Out with Python (3rd Edition)
3rd Edition
ISBN: 9780133582734
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 9.1, Problem 12CP
Program Plan Intro
Dictionary:
- • In Python, a dictionary is defined as an unordered collection of data.
- • Each element of the dictionary is a key-value pair.
- • For each key, there is a value mapped to it.
- • Key is unique throughout the dictionary but the value may not be unique.
- • Each value in the dictionary can be accessed using the corresponding key value.
- • The keys in the dictionary cannot be modified but the values can be modified.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
keys = ['name', 'last', 'job_title', 'email']Faculty2 = Faculty = dict.fromkeys(keys)print(Faculty2)
Use the dictionaries that you created for faculty members.
Be sure that all the dictionaries have the same keys: name, last name, etc.
If there are keys or values missing, add them. If you do not have the value, you can use 'n/a' or 'TBD'.
Make a list of the dictionaries.
Loop the list to print all the information available to each faculty member.
In Python lang please.
What does the items method return?
What is the return type of a method that returns null?
Chapter 9 Solutions
Starting Out with Python (3rd Edition)
Ch. 9.1 - An element in a dictionary has two parts. What are...Ch. 9.1 - Which part of a dictionary element must be...Ch. 9.1 - Suppose ' start' : 1472 is an element in a...Ch. 9.1 - Suppose a dictionary named employee has been...Ch. 9.1 - What will the following code display? stuff = {1 :...Ch. 9.1 - Prob. 6CPCh. 9.1 - Suppose a dictionary named inventory exists. What...Ch. 9.1 - What will the following code display? stuff = {1 :...Ch. 9.1 - What will the following code display? stuff = {1 :...Ch. 9.1 - What is the difference between the dictionary...
Ch. 9.1 - Prob. 11CPCh. 9.1 - Prob. 12CPCh. 9.1 - What does the values method return?Ch. 9.2 - Prob. 14CPCh. 9.2 - Prob. 15CPCh. 9.2 - Prob. 16CPCh. 9.2 - After the following statement executes, what...Ch. 9.2 - After the following statement executes, what...Ch. 9.2 - After the following statement executes, what...Ch. 9.2 - After the following statement executes, what...Ch. 9.2 - After the following statement executes, what...Ch. 9.2 - Prob. 22CPCh. 9.2 - After the following statement executes, what...Ch. 9.2 - After the following statement executes, what...Ch. 9.2 - Prob. 25CPCh. 9.2 - Prob. 26CPCh. 9.2 - After the following code executes, what elements...Ch. 9.2 - Prob. 28CPCh. 9.2 - After the following code executes, what elements...Ch. 9.2 - After the following code executes, what elements...Ch. 9.2 - After the following code executes, what elements...Ch. 9.2 - Prob. 32CPCh. 9.3 - Prob. 33CPCh. 9.3 - When you open a file for the purpose of saving a...Ch. 9.3 - When you open a file for the purpose of retrieving...Ch. 9.3 - Prob. 36CPCh. 9.3 - Prob. 37CPCh. 9.3 - Prob. 38CPCh. 9 - You can use the __________ operator to determine...Ch. 9 - You use ________ to delete an element from a...Ch. 9 - The ________ function returns the number of...Ch. 9 - You can use_________ to create an empty...Ch. 9 - The _______ method returns a randomly selected...Ch. 9 - The __________ method returns the value associated...Ch. 9 - The __________ dictionary method returns the value...Ch. 9 - The ________ method returns all of a dictionary's...Ch. 9 - The following function returns the number of...Ch. 9 - Prob. 10MCCh. 9 - Prob. 11MCCh. 9 - This set method removes an element, but does not...Ch. 9 - Prob. 13MCCh. 9 - Prob. 14MCCh. 9 - This operator can be used to find the difference...Ch. 9 - Prob. 16MCCh. 9 - Prob. 17MCCh. 9 - The keys in a dictionary must be mutable objects.Ch. 9 - Dictionaries are not sequences.Ch. 9 - Prob. 3TFCh. 9 - Prob. 4TFCh. 9 - The dictionary method popitem does not raise an...Ch. 9 - The following statement creates an empty...Ch. 9 - Prob. 7TFCh. 9 - Prob. 8TFCh. 9 - Prob. 9TFCh. 9 - Prob. 10TFCh. 9 - What will the following code display? dct =...Ch. 9 - What will the following code display? dct =...Ch. 9 - What will the following code display? dct =...Ch. 9 - What will the following code display? stuff =...Ch. 9 - How do you delete an element from a dictionary?Ch. 9 - How do you determine the number of elements that...Ch. 9 - Prob. 7SACh. 9 - What values will the following code display? (Dont...Ch. 9 - After the following statement executes, what...Ch. 9 - After the following statement executes, what...Ch. 9 - After the following statement executes, what...Ch. 9 - After the following statement executes, what...Ch. 9 - After the following statement executes, what...Ch. 9 - What will the following code display? myset =...Ch. 9 - After the following code executes, what elements...Ch. 9 - Prob. 16SACh. 9 - Prob. 17SACh. 9 - Prob. 18SACh. 9 - After the following code executes, what elements...Ch. 9 - Prob. 20SACh. 9 - Write a statement that creates a dictionary...Ch. 9 - Write a statement that creates an empty...Ch. 9 - Assume the variable dct references a dictionary....Ch. 9 - Assume the variable dct references a dictionary....Ch. 9 - Prob. 5AWCh. 9 - Prob. 6AWCh. 9 - Prob. 7AWCh. 9 - Prob. 8AWCh. 9 - Prob. 9AWCh. 9 - Prob. 10AWCh. 9 - Assume the variable dct references a dictionary....Ch. 9 - Write code that retrieves and unpickles the...Ch. 9 - Course information Write a program that creates a...Ch. 9 - Capital Quiz The Capital Quiz Problem Write a...Ch. 9 - File Encryption and Decryption Write a program...Ch. 9 - Unique Words Write a program that opens a...Ch. 9 - Prob. 5PECh. 9 - File Analysis Write a program that reads the...Ch. 9 - World Series Winners In this chapters source code...Ch. 9 - Name and Email Addresses Write a program that...Ch. 9 - Blackjack Simulation Previously in this chapter...
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
- A computer store uses a database to track inventory. The database has a table named Inventory , with the following columns: ProductID INTEGER PRIMARY KEY NOT NULL ProductName TEXT QtyOnHand INTEGER Cost REAL Also assume that the cur variable references a Cursor object for the database. Write Python code that does the following: Executes a SELECT statement to return all the columns from the rows where ProductName contains the string "Laptop" with any characters before or after it. Assigns all the results of the SELECT statement to a variable named results .arrow_forwardIn R, how to find the number of rows in an object? Please use the which statementarrow_forwardPendant Publishing edits multi-volume manuscripts for many authors. For each volume, they want a label that contains the author’s name, the title of the work, and a volume number in the form Volume 9 of 9. For example, a set of three volumes requires three labels: Volume 1 of 3, Volume 2 of 3, and Volume 3 of 3. Design an application that reads records that contain an author’s name, the title of the work, and the number of volumes. The application must read the records until eof is encountered and produce enough labels for each work. The flowchart must include a call symbol, at the beginning, to redirect the input to the external data file. create a solution algorithm using pseudocode create a flowchart using RAPTORarrow_forward
- Pendant Publishing edits multi-volume manuscripts for many authors. For each volume, they want a label that contains the author’s name, the title of the work, and a volume number in the form Volume 9 of 9. For example, a set of three volumes requires three labels: Volume 1 of 3, Volume 2 of 3, and Volume 3 of 3. Design an application that reads records that contain an author’s name, the title of the work, and the number of volumes. The application must read the records until eof is encountered and produce enough labels for each work. Design a flowchart and psuedocode Pendant Publishing.arrow_forwardWhat does range return? for x in range(5) the sequence of numbers: 1,2,3, 4, 5 the sequence of numbers: 012345 the sequence of numbers: 1234, the sequence of numbers: 01234arrow_forwardWrite an Add method that adds the contents of the decPrice variable to the lstPrices control.arrow_forward
- A computer store uses a database to track inventory. The database has a table named Inventory, with the following columns: ProductID INTEGER PRIMARY KEY NOT NULL ProductName TEXT QtyOnHand INTEGER Cost REAL Also assume that the cur variable references a Cursor object for the database. Write Python code that does the following: Executes a SELECT statement to return all the columns from the rows where Cost is less than 999.99. Assigns all the results of the SELECT statement to a variable named results.arrow_forwardCatch blocks allow how many arguments?arrow_forwardQuestion: Narcissistic numbers Prompt the user for an upper and a lower bound.(Note: we will test for at least 100-50000 range) Display all the narcisstic numbers that exist between the lower and upper bounds, both inclusive. https://en.wikipedia.org/wiki/Narcissistic_number This link describes what narcisstic numbers are. A narcisstic number of order 4 is a 4-digit number, such that the number xyzd = x^4 + y^4 + z^4 + d^4 A narcisstic number of order 3 is a 3-digit number, such that the number xyz = x^3 + y^3 + z^3 e.g. 153 is a narcissistic number of order 3 as 1^3 + 5^3 + 3^3 is equal to 153 where the ^ operator indicates raised to the power of, e.g. x^3 is x raised to the power of 3. In Python, x**3 is used to calculate x raised to the power of 3.arrow_forward
- Please help with Java code. Create student class Name Id Marks Create array of 10 student and print all studentsarrow_forwardHomework Instructions: For each Exercise below, write your code in an IDE and run your code within the IDE as well. Once you have satisfied the Exercise requirements, paste your code below under the corresponding Exercise. Exercise 1: Dogs mature at a faster rate than human beings. If you own a dog, you might've heard this rule: one year for Snoopy equals seven years for you. Turns out, the math isn't that simple. Dogs mature more quickly than we do early on. Here's how we can convert your dog's age into human years. The first two years of a dog's life count as 21 human years. ● Each following year counts as 4 human years. So, a one-year-old dog is 10.5 years old in human years, and a two-year-old dog is 21 years old in human years. How to write a C++ program called dog_years.cpp to calculate the age, in human years, of any dog older than 2. Exercise 2: The Pythagorean Theorem states that the hypotenuse (c) is the sum of the squares of the other two sides (a and b). This can be written…arrow_forwardVBA - EXCEL Engine – optional – this indicates the solving method that needs to be used to get to a solution. 1 for the Simplex LP method, 2 for the GRG Nonlinear method, or 3 for the Evolutionary method. This corresponds to the Select a Solving Method dropdown list in the Solver Parameters dialog box EngineDesc – optional -this is an alternate way of selecting the solving method – here you would type the strings “Simplex LP”, “GRG Nonlinear” or “Evolutionary”. This also corresponds to the Select a Solving Method dropdown list in the Solver Parameters dialog box What happens when the code demonstrates: Engine:=1, EngineDesc:="GRG Nonlinear" ?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningNew Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage