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.
Solution:
#dictionary room created that contain course number and the
corresponding room number
rooms={'CS101':3004,'CS102':4501,'CS103':6755,'NT110':1244,'CM241':1411}
#dictionary instructors created that contain course number and the
corresponding instructor name
instructors={'CS101':'Haynes','CS102':'Alvarado','CS103':'Rich','NT110':'Burke','CM241':'Lee'}
#dictionary times created that contain course number nd the
corresponding time
times={'CS101':'8:00 am','CS102':'9:00 am','CS103':'10:00
am','NT110':'11:00 am','CM241':'1:00 pm'}
#taking course number as input from user
num=input("Enter a course number : ")
#checking weather the course exist in dictionary
if num in rooms.keys():
#printing the
required details of course
print("The details for course ",num," are:")
print("Room:",rooms[num])
print("Instructor:",instructors[num])
print("Time:",times[num])
#in case the course does not exist in the dictionary
else:
print(num,"is an invalid course number")
Key() used in the above code is used to get all the key values from the dictionary
Note: If you find any error in the above code it may be due to improper indentation occurred while copying the code ,So please provide proper indentation with the help of attached screenshot with the answer
If you find my answer helpful,please give thumbs up,Thank you
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...