Starting Out With Python (Looseleaf)-With Access
3rd Edition
ISBN: 9780133862263
Author: GADDIS
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 9, Problem 7MC
The __________ dictionary method returns the value associated with a specified key. If the key is not found, it returns a default value.
a. pop ()
b. key ()
c. value ()
d. get ()
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Now do it the fixed sliding window of building a tri-gram dictionary method. You can start after 256 for the dictionary index.
(a) Use window size 3 for the text: “pugonthepugonrug”
(b) Think about how many of these tri-grams are used (or not used). Can you think of a way to reduce the number of tri-grams that only occur once?
//inserts e at index ind
publicvoidadd(intind,Te){
//if index is invalid display a message and return
//valid index are 0 to size
//push all elements up by one all the down to index ind (stop at index ind)
//insert e at index ind
//increase the size
}
A Dictionary object’s Remove method returns an integer indicating the number of elements that were removed.
Question 48 options:
True
False
Chapter 9 Solutions
Starting Out With Python (Looseleaf)-With Access
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...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
What are the design issues for character string types?
Concepts of Programming Languages (11th Edition)
Define each of the following terms: determinant functional dependency transitive dependency recursive foreign k...
Modern Database Management
The following C++ program will not compile because the lines have been mixed up. cout Success\n; cout Success...
Starting Out with C++ from Control Structures to Objects (9th Edition)
When a selector name starts with a period in a JavaFX CSS style definition, it means the selector corresponds t...
Starting Out with Java: Early Objects (6th Edition)
Computers process data under the control of sets of instructions called
Java How To Program (Early Objects)
Are reflex actions (such as flinching from a hot stove) rational? Are they intelligent?
Artificial Intelligence: A Modern Approach
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
- Repeatedly ask the user to enter game scores in a format like team1 score1 - team2 score2. Store this information in a dictionary where the keys are the team names and the values are lists of the form [wins, ties,losses]. An example is shown below: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_forward‘Write a program to maintain grades for a class. The program will repeatedly prompt the user with the following menu, and use functions to perform the tasks ofuser's choice. Exit 1. Enter student info 2. Print grades for a student 3. Print class max, min, and average grades The program should use a dictionary to keep information about a student, including the student names and grades for three exams: midterm 1, midterm 2 andfinal exam. Assume the grades are positive integers between 0 and 100. The program should keep information about the students in a list for the entire class. ‘Assample run of the program is as follows. Exit 1. Enter student info 2. Print grades for a student 3. Print class max, min, and average grades Enter your choice: 1 Do you want to enter student info (y/n):Enter the student name: Adams Enter midterm 1 grade: 85 Enter midterm 2 grade: 87 Enter final exam grade: 90 Do you want to enter student info (y/n!Enter the student name: Mary Enter midterm 1 grade: 78 Enter…arrow_forward
- Python coding language Create a static dictionary with a number of users and with the following values: First name Last name Email address Password Ask the user for: 5. Email address 6. Password Loop (for()) through the dictionary and if (if()) the user is found print the following: 7. Hello, first name last name you have successfully logged in 8. Notify the user if the password and email address are wrong 9. Additional challenge: if you want the program to keep asking for a username and password when the combination is wrong, you will need a while() loop. 10. Save the file as assignment03yourlastname.pyarrow_forwardplease solve these Part 21. Create a dictionary named password_lookup that contains usernames askeys and passwords as associated string values. Make up data for five entries.2. Write a program that creates an initially empty dictionary namedpassword_lookup, prompting one-by-one for usernames and passwords(until a username of 'z' is read) entering each into the dictionary.3. Create a dictionary named password_hint that contains email addressesas keys, and associated values that contain both the users’ “password securityquestion,” and the answer to the question. Make up data for dictionary entries.4. Create a dictionary named member_table that contains users’ emailaddresses as keys, and answers to their password hints as the associated values,and a function that generates a temporary new password and stored in the table.arrow_forwardWhich of the following is not a dictionary method?a) get b) keys c) sort d) cleararrow_forward
- Name SearchIn the Chap07 folder of the Student Sample Programs, you will find the followingfiles:• GirlNames.txt—This file contains a list of the 200 most popular names given to girls born in the United States from 2000 through 2009.• BoyNames.txt—This file contains a list of the 200 most popular names given to boys born in the United States from 2000 through 2009.Create an application that reads the contents of the two files into two separatearrays or Lists. The user should be able to enter a boy’s name, a girl’s name, orboth, and the application should display messages indicating whether the nameswere among the most populararrow_forwardCreate a dictionary (order_dict) that the key is the burger number, and the value is a list of the quantities. For example: order_dict which is {'1': [10, 3, 78], '2': [35, 0, 65], '3': [9, 23, 0], '4': [0, 19, 43], '5': [43, 0, 21]} Create a dictionary (total_order_dict) that the key is the burger number, and the value is the total of the quantities for that burger. For example: total_order_dict which is {'1': 91, '2': 100, '3': 32, '4': 62, '5': 64} Use "assert to test the values of the total_order_dict For example: expected_result_ototal_order_dict = {'1': 91, '2': 100, '3': 32, '4': 62, '5': 64} assert actual_result_ototal_order_dict['1'] == expected_result_ototal_order_dict['1'] , "The actual result is not the \same as expected result for the order number 1!" (and test the other elements) The function can be like: def test_sum(): #Testing assert actual_result_ototal_order_dict['1'] == 91, "The actual result is not the \ same as expected result for the…arrow_forwardDecision blocks can be used to control the flow of code based on different outcomes produced by relational blocks. What type of data must relational blocks evaluate to? Select one: a. Dictionary b. Number c. List d. Boolean e. TinyDB f. Textarrow_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_forwardThe intNums array contains six elements. Which of the following increases the number of elements to eight?a. ReDim Preserve intNums(2)b. ReDim Preserve intNums(7) c. ReDim intNums(2)d. Preserve ReDim intNums(8)arrow_forwardWhat is printed to the console when the code that follows is executed? ArrayList<String> passwords = new ArrayList<>(); passwords.add("akjdk12"); passwords.add("buujl32"); passwords.add("chrcl92"); passwords.add("nnnii87"); passwords.set(2, "cb2kr45"); passwords.remove("akjdk12"); System.out.println(passwords.get(1));arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Dictionaries - Introduction to Data Structures (Episode 8); Author: NullPointer Exception;https://www.youtube.com/watch?v=j0cPnbtp1_w;License: Standard YouTube License, CC-BY