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
High capacity circuits are limited by the least capable network link, which is typically the user connection. As such, it is imp
Mariana [72]
The answer is “true”
4 0
4 years ago
Here's something to stop you from getting repetitive when writing essays. Write a program that reads multiple lines of plain tex
Marianna [84]

Answer:

The output is attached below

Explanation:

d = {}

while True:

line = input("Enter line: ")

if len(line)==0:

break

token = line.split(' ')

for var in token:

try:

if len(var)==0:

continue

count = d[var]

d[var] = count + 1

except KeyError:

d[var] = 1

pass

for word in sorted(d):

print(word , d[word])

------------------

7 0
4 years ago
In what year was the first permanent photographic image created?
kvv77 [185]

Answer:

1826

Explanation:

it was in 1826 when the first permanent photographic image was created.

5 0
2 years ago
Simpson is trying to solve an equation related to converting a decimal number to its hexadecimal form. He decides to utilize the
Murljashka [212]

Answer:

the answer is A.

6 0
4 years ago
300134223+304532264440=
sweet [91]

Answer:

304,832,398,663

hope it helps

3 0
3 years ago
Read 2 more answers
Other questions:
  • What type of organizational structure would you want to use for this company (by function, by process, by product, and so on)? E
    11·1 answer
  • A ________ is a material deficiency, or combination of significant deficiencies, that results in more than a remote likelihood t
    6·1 answer
  • A queueing system has four crews with three members each. The number of "servers" is:
    5·2 answers
  • For the recursive method below, list the base case and the recursive statement, then show your work for solving a call to the re
    8·1 answer
  • Trong ửod muốn trình bày dạng cột càn thực hiện lệnh nào
    13·1 answer
  • I need some help with this assignment. I'm having difficulty trying come up ideas to use here. Can I get any help?
    5·1 answer
  • You text file begins with the following rows. The pattern is a description of the item to be repaired, its color, and the issue.
    14·1 answer
  • Hosts on the Internet have ________ addresses. Group of answer choices both A and B neither A nor B IP data link
    13·1 answer
  • swer from the options 1. How many basic input devices does a desktop computer have? a)2 b)3 c)1 d)4 2. The computer equipment wh
    8·1 answer
  • Writing queries in sql to compile data from a database is related to the physical level of databases true or false?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!