Question: Question 2 [20 marks] A hotel needs your help. Write a program called hotel_061.py that reads a single line of numbers from stdin. The first

 Question 2 [20 marks] A hotel needs your help. Write a

Question 2 [20 marks] A hotel needs your help. Write a program called hotel_061.py that reads a single line of numbers from stdin. The first number in each line is, N, the number of rooms in the hotel. Rooms are numbered 1 to N. N is in the range 1-1000. Following N is a list of the rooms that are occupied. Occupied room numbers are listed in random order and in the range 1-N. Each occupied room number appears no more than once in the list. It is possible that no rooms are occupied. Write a program that reads the above input and outputs the lowest numbered available room or no room if none are available. In this example there are 5 rooms in the hotel, rooms 4, 2, 1 are occupied. So the lowest numbered available room is 3: $ cat hotel_stdin_00_061.txt 5 4 2 1 $ python3 hotel_061.py

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!