Question

Write code to create a Python dictionary called class. Add two entries to the dictionary: Associate...

Write code to create a Python dictionary called class. Add two entries to the dictionary: Associate the key 'class_name' with the value 'MAT123', and associate the key 'sect_num' with '211_145' PYTHON

Homework Answers

Answer #1

Python code:

#creating a dictionary called called Class
Class={}
#adding to it key class_name and value MAT123
Class["class_name"]="MAT123"
#adding to it key sect_num and value 211_145
Class["sect_num"]="211_145"
#printing the Class dictionary
print(Class)


Screenshot:


Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a Python program to create a dictionary from two lists without losing duplicate values. If...
Write a Python program to create a dictionary from two lists without losing duplicate values. If there is more values in the key list, then provided key should return an empty set if there is no match. (Hint: use defaultdict) Example: class_list = ['Class-V', 'Class-VI', 'Class-VII', 'Class-VIII','Class-IX'] id_list = [1, 2, 2, 3] Output: assuming you store the values in a data structure named temp print(temp["Class-V"]) # {1} print(temp["Class-IX"]) # set() can you please try and do on google colab
8) Write Python code for a function called occurances that takes two arguments str1 and str2,...
8) Write Python code for a function called occurances that takes two arguments str1 and str2, assumed to be strings, and returns a dictionary where the keys are the characters in str2. For each character key, the value associated with that key must be either the string ‘‘none’’, ‘‘once’’, or ‘‘more than once’’, depending on how many times that character occurs in str1. In other words, the function roughly keeps track of how many times each character in str1 occurs...
On python a) Create a dictionary with 5 to 10 key-values so that state is the...
On python a) Create a dictionary with 5 to 10 key-values so that state is the key and its capital is the value. Print the dictionary and its length. b) Create and print a list of states and a list of capitals. c) Ask the user for a state's name. Check to see if the state's name exists in the list of states. If it does, look up the state's name in the dictionary and print out its capital. If...
Homework Assignment 5 Instructions: Class name must be: HW5_yourName For example: Michael will name the python...
Homework Assignment 5 Instructions: Class name must be: HW5_yourName For example: Michael will name the python file of homework assignment 5 as HW5_Michael.py Grading Rubric: Code running and as per the required conditions and giving expected output = 10 points File named as per instructions = 1 point Comments in code = 4 points Problem: Average calculation of test scores using a Dictionary Write a program that reads a text file named Asg5_data.txt and stores the name of the student...
Hello! I am confused on the code for this question. Write a complete Python function called...
Hello! I am confused on the code for this question. Write a complete Python function called Frog, with two integer parameters M and N, where N has the default value of 5. The function computes and returns one of two results: if N is odd it returns the equation 2 * M + N, but if it is even it returns the equation 3 * M - N instead.
Python Problem 1 Create a function, biggest_ip_sum, outside of the ServerClass class, that: 1. Takes two...
Python Problem 1 Create a function, biggest_ip_sum, outside of the ServerClass class, that: 1. Takes two ServerClass objects 2. Sums the octets of the IP together (example 127.0.0.1 = 127+0+0+1 = 128) 3. Returns the larger number Example: server_one = ServerClass("127.0.0.1") server_two = ServerClass("192.168.0.1") result = biggest_ip_sum(server_one, server_two) print(result) In the example above, result will be 361. _________________________________ Problem 1 Here is the code to start with class ServerClass: """ Server class for representing and manipulating servers. """ def __init__(self,...
Python pls create a function called search_position. This function returns a dictionary. team1 = {'Fiora': {'Top':...
Python pls create a function called search_position. This function returns a dictionary. team1 = {'Fiora': {'Top': 1, 'Mid': 4, 'Bottom': 3},'Olaf': {'Top': 3, 'Mid': 2, 'Support': 4},'Yasuo': {'Mid': 2, 'Top': 5},'Shaco': {'Jungle': 4, 'Top': 2, 'Mid': 1}} def search_position(team1): should return {'Top': {'Fiora': 1, 'Yasuo':5,'Olaf':3,'Shaco':}, 'Jungle': {'Shaco': 4}, 'Mid': {'Yasuo', 2, 'Fiora': 4,'Olaf':2}, 'Bottom': {'Fiora': 3}, 'Support': {'Olaf': 4}}
Write python code for the queue class buuilt with a linked list using: First- returns first...
Write python code for the queue class buuilt with a linked list using: First- returns first value in queue, PrintQ-returns whole queue as list, RemoveValue-removes specific value from queue, RemoveIndex-removes value from queue by index
Create a new dictionary called quantities using {} format like. Complete the following: Put these values...
Create a new dictionary called quantities using {} format like. Complete the following: Put these values (quantity, price) in your quantities dictionary: "baskets": (4, 2.49) "boxes": (2, 1.95) "bags": (5, 1.29) "crates": (3, 5.99) Print the quantities dictionary Loop through each key in quantities. For each key, print out the key along with its corresponding quantity. Print the answer in the following format: baskets: 4 boxes: 2 bags: 5 crates: 3 Print the total number of items (should be 14)....
By using Python: a, Make a class called Book. The __init__() method for Book should store...
By using Python: a, Make a class called Book. The __init__() method for Book should store two attributes: a title and an author. Make a method called book_info() that prints these two pieces of information, and a method called book_available() that prints a message indicating that the book is available in the library. b. Create an instance called book1 from your class. Print the two attributes individually, and then call both methods.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT