Question

You are an administrator. You want to track some of the courses being offered. Write a...

You are an administrator. You want to track some of the courses being offered. Write a python program that will allow you to enter four pieces of information:

  • The course number
  • The room number
  • The instructor
  • The meeting time

Use 3 dictionaries (rooms, instructors, times) to store this information. The course number would be the key in the three dictionaries, and the other items would be the values.

Allow for six courses and their associated items.

After creating the dictionaries , ask the user what to search for. When you search for one of the items, the other three will be found and printed.

Write a menu to allow the user to choose which item to search for. And after it printed, ask the user if they want to continue.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

code.py

def finditems(dic1, item):
res =0;
print()
for key, value in dic1.items(): # for name, age in dictionary.iteritems(): (for Python 2.x)
if value == item:
print("course:", key)
print("room : ",rooms[key])
print("instructor : ",instructors[key])
print("meeting time : ",times[key])
print()
res +=1
print("Results found :", res)
print()


rooms = {'CS101':'204','CS102':'108','EC201':'204','M101':'301','M102':'402', 'CS103':'309'}
instructors = {'CS101':'John Doe','CS102':'Khaleesi','EC201':'Harry potter','M101':'Frodo','M102':'Yoda', 'CS103':'Harry potter'}
times = {'CS101':'17:00','CS102':'15:30','EC201':'14:00','M101':'11:30','M102':'10:00', 'CS103':'08:30'}

while(True):
x = input("1 for rooms\n2 for instructor\n3 for time\nAny other key to exit\nwhat items you want to search : ")
if x =="1":
r = input("enter room number: ")
finditems(rooms,r)
elif x== "2":
i = input("enter instructur to serach :")
finditems(instructors,i)
elif x=="3":
t = input("enter time to serach (hh:mm 24hr format):")
finditems(times,t)
else:
print("exiting")
break
  

OUTPUT

1 for rooms
2 for instructor
3 for time
Any other key to exit
what items you want to search : 1
enter room number: 204

course: CS101
room : 204
instructor : John Doe
meeting time : 17:00

course: EC201
room : 204
instructor : Harry potter
meeting time : 14:00

Results found : 2

1 for rooms
2 for instructor
3 for time
Any other key to exit
what items you want to search : 2
enter instructur to serach :TOM

Results found : 0

1 for rooms
2 for instructor
3 for time
Any other key to exit
what items you want to search : 2
enter instructur to serach :Yoda

course: M102
room : 402
instructor : Yoda
meeting time : 10:00

Results found : 1

1 for rooms
2 for instructor
3 for time
Any other key to exit
what items you want to search : 3
enter time to serach (hh:mm 24hr format):17:00

course: CS101
room : 204
instructor : John Doe
meeting time : 17:00

Results found : 1

1 for rooms
2 for instructor
3 for time
Any other key to exit
what items you want to search : 7
exiting

Add a comment
Know the answer?
Add Answer to:
You are an administrator. You want to track some of the courses being offered. Write a...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using Python. Please help! The output should looks like below. Please follow the emphasis. I think...

    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. 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...

  • 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...

  • Phyton prog COMPLETE. Problem 1: Write a program that creates a directory containing course numbers and...

    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...

  • python anywhere questions. A Class Management System, Part 2 Please also refer to the description provided...

    python anywhere questions. A Class Management System, Part 2 Please also refer to the description provided in Part 1 of the project “A Class management System”. You have had a chance to state your understanding of the requirements for this project, draft a preliminary design, and express it by means of UML diagrams. Now it’s time to implement your design. As stated in the original requirements, there will be three categories of users: 1. Students 2. Instructors 3. Administrators Recall...

  • Tying to list all the courses the teacher teaches in c++ map but only the first...

    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...

  • c++ Write a program that computes and displays the tuition for courses offered at the University....

    c++ Write a program that computes and displays the tuition for courses offered at the University. First, the program should ask if the student has registered for a regular course or a course with a lab component. The user can enter the letter 'C' or 'c' for lecture course only, or the letter 'L' or 'l' for a laboratory course . Write a function called Menu, which takes no input parameters and returns a char value. Your main program will...

  • GPA calculator: Assume the user has a bunch of courses they took, and need to calculate...

    GPA calculator: Assume the user has a bunch of courses they took, and need to calculate the overall GPA. We will need to get the grade and number of units for each course. It is not ideal to ask how many courses they took, as they have to manually count their courses. Programming is about automation and not manual work. We will create a textual menu that shows 3 choices. 1. Enter course grade and units. 2. Show GPA. 3....

  • Python GPA calculator: Assume the user has a bunch of courses they took, and need to...

    Python GPA calculator: Assume the user has a bunch of courses they took, and need to calculate the overall GPA. We will need to get the grade and number of units for each course. It is not ideal to ask how many courses they took, as they have to manually count their courses. Programming is about automation and not manual work. We will create a textual menu that shows 3 choices. 1. Input class grade and number of units. 2....

  • Use python to code! Q1 - You need to keep track of book titles. Write code...

    Use python to code! Q1 - You need to keep track of book titles. Write code using function(s) that will allow the user to do the following. 1. Add book titles to the list. 2. Delete book titles anywhere in the list by value. 3. Delete a book by position. Note: if you wish to display the booklist as a vertical number booklist , that is ok (that is also a hint) 4. Insert book titles anywhere in the list....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT