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

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

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

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

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

  • In this assignment you are asked to write a python program to maintain the Student enrollment...

    In this assignment you are asked to write a python program to maintain the Student enrollment in to a class and points scored by him in a class. You need to do it by using a List of Tuples What you need to do? 1. You need to repeatedly display this menu to the user 1. Enroll into Class 2. Drop from Class 3. Calculate average of grades for a course 4. View all Students 5. Exit 2. Ask the...

  • Need a program in python. Asterix and Obelix want to store and process information about movies...

    Need a program in python. Asterix and Obelix want to store and process information about movies they are interested in. So, you have been commissioned to write a program in Python to automate this. Since they are not very computer literate, your program must be easy for them to use. They want to store the information in a comma separated text file. Using this they would need to generate a report – see all items AND show a bar chart...

  • In this lab you will code a simple calculator. It need not be anything overly fancy,...

    In this lab you will code a simple calculator. It need not be anything overly fancy, but it is up to you to take it as far as you want. You will be creating this program in three small sections. You have the menu, the performance of the basic arithmetic operations (Addition, Subtraction Multiplication, and Division), and the looping. You may want to get the switch menu working first, and then fill in the code for these four arithmetic operations...

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
ADVERTISEMENT