Course information
Write a
Course Number (key) | Room Number (value) |
CS101 | 3004 |
CS102 | 4501 |
CS103 | 6755 |
NT110 | 1244 |
CM241 | 1411 |
The program should also create a dictionary containing course numbers and the names of the instructors that teach each course. The dictionary should have the following key-value pairs:
Course Number (key) | Instructor (value) |
CS101 | Haynes |
CS102 | Alvarado |
CS103 | Rich |
NT110 | Burke |
CM241 | Lee |
The program should also create a dictionary containing course numbers and the meeting times of each course. The dictionary should have the following key-value pairs:
Course Number (key) | Meeting Time (value) |
CS101 | 8:00 am |
CS102 | 9:00 am. |
CS103 | 10:00 a.m. |
NT110 | 11:00 a.m. |
CM241 | 1:00 p.m. |
The program should let the user enter a course number, then it should display the course’s room number, instructor, and meeting time.
Learn your wayIncludes step-by-step video
Chapter 9 Solutions
Starting Out with Python (4th Edition)
Additional Engineering Textbook Solutions
Database Concepts (8th Edition)
Starting Out with Java: Early Objects (6th Edition)
Starting Out With Visual Basic (7th Edition)
Digital Fundamentals (11th Edition)
Introduction To Programming Using Visual Basic (11th Edition)
- Python Programming Assignment: Create a dictionary that takes a basketball team's information (that includes team's name and points) as parameter, creates a teams_dict and returns it. Also, create a parameter for write_file parameter that opens current results text file in write mode and writes the dictionary information to file as per format and closes the file.arrow_forwardAssume the variable dct references a dictionary. Write an if statement that determines whetherthe key 'James' exists in the dictionary. If so, display the value that is associated with that key.If the key is not in the dictionary, display a message indicating so.arrow_forwardAssume the variable definitions references a dictionary. Write an if statement that determines whether the key 'marsupial' exists in the dictionary. If so, delete 'marsupial' and its associated value. If the key is not in the dictionary, display a message indicating so.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_forwardOverview This program will have you use a loop to prompt a user for three foods and their country of origin and then store them in a dictionary called food_dict). Then, it will prompt the user for a dish that they like and then will tell them the country of origin. Expected Output Example 1 What is good to eat? Tacos What country is that from? Mexico What is good to eat? Pho What country is that from? Vietnam What is good to eat? Burgers What country is that from? America What dish do you like? Burgers Burgers is from America Example 2 What is good to eat? Pizza What country is that from? Italy What is good to eat? Spaghetti What country is that from? Italy What is good to eat? Gelato What country is that from? Italy What dish do you like? Pizza Pizza is from Italy Specifications • You should submit a single file called M4A2.py • It should follow the submission standards outlined here: Submission Standards • Your program should start by defining an empty dictionary called food_dict •…arrow_forwardData structures concatenate_dict(dict_list:list)->dict This function will be given a single parameter known as the Dictionary List. Your job is to combine all the dictionaries found in the dictionary list into a single dictionary and return it. There are two rules for adding values to the dictionary: 1. You must add key-value pairs to the dictionary in the same order they are found in the Dictionary List. 2. If the key already exists, it cannot be overwritten. In other words, if two or more dictionaries have the same key, the key to be added cannot be overwritten by the subsequent dictionaries. Example: Dictionary List: [{'Z': 6, 'k': 10, 'w': 3, 'I': 8, 'Y': 5}, {'Y': 1, 'Z': 4}, {'X': 2, 'L': 5}] Expected: {'Z': 6, 'k': 10, 'w': 3, 'I': 8, 'Y': 5, 'X': 2, 'L': 5} Dictionary List: [{'z': 0}, {'z': 7}] Expected: {'z': 0} Dictionary List: [{'b': 7}, {'b': 10, 'A': 8, 'Z': 2, 'V': 1}] Expected: {'b': 7, 'A': 8, 'Z': 2, 'V': 1}arrow_forward
- ASSIGNMENT REQUIREMENTS This assignment requires a dictionary of state abbreviations and their capital cities. The abbreviations are the keys and the state capitals are the values. Start by entering data for any four states of your choice. Then, report this count but use a function to get the count. Use a while loop to add more abbreviations and capitals. The loop should continue until the user presses Enter when prompted for an abbreviation. Inside the while loop: If the state entered is already in the dictionary, report its capital. If it is not in the dictionary, prompt the user to enter the capital for that state and add it to the dictionary After the while loop ends: Report again the count of the number of states in the dictionary. Using another loop and the items() method, display all the state abbreviations and their capitals. In the same Python program write this code, although it has nothing to do with the states code. Using a dictionary comprehension, create a…arrow_forwardASSIGNMENT REQUIREMENTS This assignment requires a dictionary of state abbreviations and their capital cities. The abbreviations are the keys and the state capitals are the values. Start by entering data for any four states of your choice. Then, report this count but use a function to get the count. Use a while loop to add more abbreviations and capitals. The loop should continue until the user presses Enter when prompted for an abbreviation. Inside the while loop: If the state entered is already in the dictionary, report its capital. If it is not in the dictionary, prompt the user to enter the capital for that state and add it to the dictionary After the while loop ends: Report again the count of the number of states in the dictionary. Using another loop and the items() method, display all the state abbreviations and their capitals. In the same Python program write this code, although it has nothing to do with the states code. Using a dictionary comprehension, create a…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
- python exercise: Write a Python function called get_top_students that takes the list of dictionaries as input and returns a dictionary containing the name and GPA of the top two students in the list. Each dictionary has the following keys: "name", "age", "major", and "gpa".arrow_forwardExercise: Least Dictionary Value Description In this exercise you will find the value in a dictionary with the least value. Least means that the value is less than or equal to all other values in the dictionary. Remember that the 2 Assistant Object inspectorarrow_forwardAssume, you are given two dictionaries. The dictionary named current_sem_data contains the GPA of 3 students of their current semester courses. The dictionary named previous_sem_data contains their previous semesters’ CGPA and credits completed respectively. Assume that all courses are of 3 credits each.current_sem_data = {"John":[4.0,3.7,4.0], "Tom":[3.3,3.7,4.0], "Harry":[3.3,3.7,4.0]}previous_sem_data = {"John":[3.88,90], "Tom":[3.52, 70], "Harry":[3.25,85]}Now, write a Python program that will take a student’s name as user input and calculate and print that student’s current CGPA using both the given dictionaries.FORMULA for calculating CGPA:current_total_GPA= ∑ (current course grade X credit)previous_total_GPA= Previous CGPA* total credits previouslyC.G.P.A = (current_total_GPA + previous_total_GPA)/(Total Credits completed till current semester)=======================================================Sample Input 1:JohnSample Output 1:*****Data for John*****Previous semester's…arrow_forward
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage