Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
2-
Consider the following Python dictionary:
{'Wednesday': 'Wednesday', 'Thursday': 'chilly'}Using the in keyword, would 'Wednesday' be considered a member of this dictionary? Ensure that you select the answer which also includes a correct explanation.
a.
No, because it is not a value in the dictionary.
b.
Yes, because it is a value in the dictionary.
c.
No, because it is not a key in the dictionary.
d.
No, because it is not both a key and a value in the dictionary (not just one or the other).
e.
Yes, because it is a key in the dictionary.
f.
Yes, because it is both a key and a value in the dictionary (not just one or the other).
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 2 steps with 1 images
Knowledge Booster
Similar questions
- 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, 'program':1}arrow_forwardneed help with python code. can you please keep it simple, I mean can you not use high-level python codes to answer this.arrow_forwardSuppose we use a Python dictionary to store gradebooks of multiple courses. gradebooks = {'Course 1': [['Troy', 92], ['Alice', 95]], 'Course 2': [['James', 89], ['Charles', 100], ['Bryn', 59]], 'Course 3': [['Jack', 74], ['Karren', 97], ['Astha', 92], ['Nancy', 96]]} Use the builtin sorted function with appropriate programming constructs (e.g., lambdas, comprehensions, , etc.) to complete the following tasks: Write code to create a new list named gradebooks_a, with students of each course being sorted by score in descending order. The expected result is: [[['Alice', 95], ['Troy', 92]], [['Charles', 100], ['James', 89], ['Bryn', 59]], [['Karren', 97], ['Nancy', 96], ['Astha', 92], ['Jack', 74]]]arrow_forward
- 4- Given a dictionary: capitals= {'CHINA': 'BEIJING','CUBA': 'HAVANA', 'USA': 'WASHINGTON, D.C.'} Write a python program to print keys and values in new line. Example output: CHINA BEIJING CUBA . . .arrow_forwardWrite a Python program that capturers the marks of any number of students. The program should store the marks in a dictionary with the name of the student as the key and mark as the value. Create the following functions to summarise the marks of the students: Average mark Highest mark The total mark Display these values in the main function.arrow_forwardPlease answer the ques in python with showing the codesarrow_forward
- How can you copy the entire dictionary to a new dictionary?arrow_forward2. Repeat the previous problem but instead of a query word, input a query number (a threshold) and return a Python dictionary that contains the words with its corresponding counts exceeding or equal to the query number In [ ]: import string # import string for punctuation characters def commonwords (filename, threshold): if type(filename) is not str: raise TypeError("First arguments must be a string") if type (threshold) is not int: raise TypeError("Second arguments must be an integer") # YOUR CODE HERE raise NotImplementedError() In [ ]: # DO NOT MODIFY, THIS IS UNIT TESTING! [1 pt] from nose.tools import assert_equal, assert_is_instance assert equal (commonwords ("alice29.txt", see), ('the': 1514, "to': 717, 'and': 774, 'a': 610}) assert equal (commonwords ("alice29.txt", 350), ('I': 401, 'the': 1514, 'Alice': 385, 'was': 352, 'to': 717, 'of': 493, "and': 774, 'she': 497, 'it': 482, 'in': 35) assert equal (commonwords ("alice29.txt", 200), ('I': 401, 'the': 1514, 'Alice': 385, 'Nas':…arrow_forwardDisplays a rank in the defined dictionary.a) Create a dictionary, rank = {1:"Freshman", 2:"Sophmore", 3:"Junior", 4:"Senior"}b) Request a user input for a number of years.c) Print the value of the matching key in the dictionary.d) Print the error message if input is invalid. In actual code and psuedocode. Using python programming language.arrow_forward
- Write python program named "YourStorelD_Inventory.py" focusing on inventory data: You have a list of dictionaries representing items in a store. Each dictionary contains the item name, quantity in stock, and the price per unit. Perform the following tasks: (a) Calculate and display the total value of the inventory (sum of quantity * price for each item). (b) Identify and display the item with the highest total value (quantity * price). (c) Implement a function that takes a user-input item name and searches for it in the list. If found, display the quantity in stock and the total value of that item; if not found, print a message indicating that the item is not in the inventory. (d) Implement a sorting algorithm of your choice to sort the items based on their total values in descending order and display the sorted list. Make sure to incorporate functions for each task and display the results in the main function with appropriate messages.arrow_forwardComputer Science Code need to be python. Please comment all lines of code. Thank you (: 1. Create a dictionary of 7 countries and their capitals, then turn it into a list of sub list, each sub list contains two elements, a country and its capital. Ask the user to enter a country, the program should return its capital.arrow_forwardNeed help with this python question not sure how to decipher it thanks! # 1. Create a dictionary called users, that includes the user name as the key and password as the value. # Both the user name and password should be strings # The dictionary should contain: tatkinson - !2054570Athu, jcarter - 2#064636Cjas, hcheloa - 66$90154Chan, # kmcphee - 206@2113Mkar, npeterson - 2052&833Pnicarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY