1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Elina [12.6K]
3 years ago
7

Write a Python program that creates a dictionary containing course numbers and the room numbers of the rooms where the course me

ets. 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 that 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 for 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 am NT110 11:00 am CM241 1:00 pm The program should let the user enter a course number, then it should display the course’s room number, instructor, and meeting time. Ask the user multiple times until he or she decides to exit (y / n).
Computers and Technology
1 answer:
alisha [4.7K]3 years ago
6 0

Answer:

Following are the program in the Python Programming Language:

#set dictionary

rooms ={}

rooms.update({'CS101' : 3004})

rooms.update({'CS102' : 4501})

rooms.update({'CS103' : 6755})

rooms.update({'NT110' : 1244})

rooms.update({'CM241' : 1411})

#set dictionary

instructors={}

instructors.update({'CS101' : 'Haynes'})

instructors.update({'CS102' : 'Alvarado'})

instructors.update({'CS103' : 'Rich'})

instructors.update({'NT110' : 'Burke'})

instructors.update({'CM241' : 'Lee'})

#set dictionary

time={}

time.update({'CS101' : '8:00 a.m'})

time.update({'CS102' : '9:00 a.m'})

time.update({'CS103' : '10:00 a.m'})

time.update({'NT110' : '11:00 a.m'})

time.update({'CM241' : '1:00 p.m'})

while True:

 n=input("You want to continue(y/n): ")

 if(n=="n"):

   break

 else:

   cours=input('Enter a course number: ')

   try:

     print()

     print("Room Number: ", rooms[cours])

     print("Instructors: ",instructors[cours])

     print("Meeting time: ", time[cours])

   except KeyError:

     print("Invalid")

<u>Output</u>:

You want to continue(y/n): y

Enter a course number: CS101

Room Number:  3004

Instructors:  Haynes

Meeting time:  8:00 a.m

You want to continue(y/n): y

Enter a course number: NT1244

Invalid

You want to continue(y/n): y

Enter a course number: NT110

Room Number:  1244

Instructors:  Burke

Meeting time:  11:00 a.m

You want to continue(y/n): n

Explanation:

Here we define three dictionary type variables "rooms", "instructors", "time"

and assign value in these dictionaries by the update() method.

Then, we set the while loop inside it:

  • set a variable "n" and get input from the user.
  • set the if conditional statement and pass the condition is the variable "n" is equal to the value "n" then, loop is break otherwise,
  • we get an input from the user in the variable "cours" and apply try block inside it, we print "room number", "Instructor", "Meeting time" as given in the output and in except block it print "Invalid".

You might be interested in
In a swap you need a _____________ variable so that one of the values is not lost.
Marat540 [252]

Answer:

i would love to actually answer this im so sorry

Explanation:

8 0
3 years ago
Read 2 more answers
Assume that your body mass index (BMI) program calculated a BMI of 20.6. What would be the value of category after this portion
algol [13]

Answer:

B normal is the answer

5 0
3 years ago
Read 2 more answers
Arrange the steps of the basic decision-making process in the correct order.
Maru [420]
Identify, gather information, identify any alternatives, weigh the evidence, choose among alternatives, take action, review you decision 
8 0
3 years ago
Read 2 more answers
A microcomputer that is smaller, lighter, and less powerful than a notebook, and which has a touch sensitive screen, is called a
bekas [8.4K]

I guess the answer in the blank is Tablet.

A microcomputer that is smaller, lighter, and less powerful than a notebook, and which has a touch sensitive screen, is called a tablet.

7 0
3 years ago
To stretch a photo or video to fill the project frame click on the clip in the timeline and adjust which setting in the effects
astra-53 [7]

Answer:

Explanation:

In video editing programs we can use the timeline in different ways, for example:

  • Speed/Duration command
  • Rate Stretch tool
  • Time Remapping feature

We can modify the speed of the clip making it faster or slower, or we can modify the duration, shortening or lengthening the video frame by frame, this method can be used in the audio too.

7 0
3 years ago
Other questions:
  • What is one advantage of top-down programming design?
    13·2 answers
  • An organization that operates a small web-based photo backup business is evaluating single points of failure. The organization h
    7·1 answer
  • A technician is trouble-shooting an IDE hard drive that is emitting a humming sound. They suspect a faulty connector. Which of t
    6·1 answer
  • "_____ devices improve memory by encoding items in a special way."
    13·1 answer
  • Using the find and replace tool would be most appropriate when
    6·2 answers
  • (1) Prompt the user to enter a string of their choosing. Output the string.
    11·1 answer
  • Consider the following code:
    13·1 answer
  • Free poi nts here you go
    5·1 answer
  • Điền dữ liệu cho cột Phân loại theo điều kiện sau:
    10·1 answer
  • - Discuss the input-process-output model as it relates to program development.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!