Python Language Only!!!!
Python Language Only!!!!
Python Language Only!!!!
Python 3 is used.
Write a program that creates a dictionary named rooms containing course numbers and the room numbers of the rooms where the courses meet. The dictionary should have the following key-value pairs:
Course Number (Key) |
Room Number (Value) |
CS101 | 3004 |
CS102 | 4501 |
CS103 | 6755 |
NT110 | 1244 |
CM241 |
1411 |
The program should also create a dictionary named instructors 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 named times containing course numbers and the meeting times of each course. The dictionary should have the following key-value pairs:
Course Number (Key) | Meeting Time (Vlaue) |
CS101 | 8:00 a.m. |
CS102 | 9:00 a.m. |
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. Otherwise, display invalid course number. Please see the outcome below.
Outcome one:
Enter a course number: CS201
CS201 is an invalid course number
Outcome two:
Enter a course number: CS101
The details for course CS101 are:
Room: 3004.
Instructor: Haynes
Time: 8:00 am
Must look exactly like outcome for full credit please double check before doing it.
Code:
#defining dictionary C_Room, C_Instructor, C_Meet C_Room = {"CS101": 3004, "CS102": 4501, "CS103": 6755, "NT110": 1244, "CM241": 1411} C_Instructor = {"CS101": "Haynes", "CS102": "Alvarado", "CS103": "Rich", "NT110": "Burke", "CM241": "Lee"} C_Meet = {"CS101": "8:00 a.m.", "CS102": "9:00 a.m.", "CS103": "10:00 a.m.", "NT110": "11:00 a.m.", "CM241": "1:00 p.m."} course_number = input("Enter the course number : ") #taking input for course number p = 0 #taking flag varible and initializing it to 0 for i in C_Room.keys(): #for loop to for iterating dictionary C_Room if(i == course_number): #condition to compare with course number #and if condition is true printing all the details here print("\nThe details of course",course_number,"are: ") print("Room:",C_Room[course_number]) print("Instructor:",C_Instructor[course_number]) print("Time:",C_Meet[course_number]) p = 1 #initailizing flag variable to 1 break else: p = 0 if(p == 0): #if flag variable = 0 then printing error message print(course_number,"is an invalid course number")
Output:
Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. Write a program...
Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. Write a program that creates a dictionary named rooms containing course numbers and the room numbers of the rooms where the courses meet. The dictionary should have the following key-value pairs: Course Number (Key) Room Number (Value) CS101 3004 CS102 4501 CS103 6755 NT110 1244 CM241 1411 The program should also create a dictionary named instructors containing course numbers and the names of the instructors that teach...
IN python, Write a program that creates a dictionary containing course numbers and the room numbers where the courses meet. The dictionary should contain the following key:value pairs. 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...
Phyton prog COMPLETE. Problem 1: Write a program that creates a directory containing course numbers and the room numbers of the rooms where the courses meet. The dictionary should have the following key-value pairs: 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...
Using Python. Please help! The output should looks like below. Please follow the emphasis. I think it just prompt user to input course name. Write a modular program that creates a dictionary containing course numbers and the room numbers of the rooms where the courses meet. The dictionary should have the following key- value pairs: 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...
Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a function named smaller that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all numbers in the list that are smaller than the number n. Write a code that declares and initializes a list of numbers and a variable number and pass them to the function to test it. Please see the outcome below:...
Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a function named smaller that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all numbers in the list that are smaller than the number n. Write a code that declares and initializes a list of numbers and a variable number and pass them to the function to test it. Please see the outcome below:...
Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a function named smaller that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all numbers in the list that are smaller than the number n. Write a code that declares and initializes a list of numbers and a variable number and pass them to the function to test it. Please see the outcome below:...
Tying to list all the courses the teacher teaches in c++ map but only the first one is being shown, not the rest of them. please help. ------------------------------------------------------------------------------------------------------------------------------ #include<iostream> #include<map> using namespace std; int main(){ map <string,string> instructors; //mapping course numbers and instructor names instructors.insert(pair<string,string>("Haynes","CS101")); instructors.insert(pair<string,string>("Haynes","CS102")); instructors.insert(pair<string,string>("Haynes","CS103")); instructors.insert(pair<string,string>("Alvarado","CS201")); instructors.insert(pair<string,string>("Alvarado","CS202")); instructors.insert(pair<string,string>("Alvarado","CS203")); char choice='y'; //looping until user wishes to quit while(choice=='y' || choice=='Y'){ cout<<"Enter a...
Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a function named smaller that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all numbers in the list that are smaller than the number n. Write a code that declares and initializes a list of numbers and a variable number and pass them to the function to test it. Please see the outcome below:...
Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. Write a function named capital_letter that accepts a string as an argument and checks if each word in the string begins with a capital letter. If so, the function will return true, otherwise, return false. Please see the outcome below: Outcome number 1: Enter a string: Python Is Really Fun! True Sample run number 2: Enter a string: i Love Python False Note: Try to keep this...