Asked by utata
def main():
floor = 10 # floor starts from 10
total_suites = 0 # counter initialized to 0 to keep total of suites of all floor
total_occupied = 0 # counter initialized to 0 to keep total available suites of all floor
while(floor <= 16): # Check floor is till 16 only
if floor == 13: # skip floor 13
continue
# ask user to input number of total suites on given floor
total = input("Number of suites on floor "+str(floor))
while True:
try:
occupied = input("The number of Occupied suites:"+)
#Check the entered user input for available suties on given floor
if 0 > occupied or occupied > total:
raise ValueError # Incorrect input will raise error message and re-ask for input
break # correct input will break out of this inner loop
except ValueError:
print("Please enter correct input")
continue # Re-ask for input
total_suites += total # Calculating the total number of suites
total_occupied +=occupied # Calculating the total number of available suites
floor +=1 # increase the floor
occupancy = (total_occupied/total_suites) * 100
if occupancy < 50:
occup_status = "Poor Occupancy"
elif 50 <= occupancy <75:
occup_status = "Acceptable Occupancy"
else:
occup_status = "Excellent Occupancy"
print("Total Suites : "+str(total_suites))
print("Total Occupied Suites : "+str(total_occupied))
print("Occupancy Percentage : "+str(occupancy)+" % "+occup_status)
if __name__ == "__main__":
main()
floor = 10 # floor starts from 10
total_suites = 0 # counter initialized to 0 to keep total of suites of all floor
total_occupied = 0 # counter initialized to 0 to keep total available suites of all floor
while(floor <= 16): # Check floor is till 16 only
if floor == 13: # skip floor 13
continue
# ask user to input number of total suites on given floor
total = input("Number of suites on floor "+str(floor))
while True:
try:
occupied = input("The number of Occupied suites:"+)
#Check the entered user input for available suties on given floor
if 0 > occupied or occupied > total:
raise ValueError # Incorrect input will raise error message and re-ask for input
break # correct input will break out of this inner loop
except ValueError:
print("Please enter correct input")
continue # Re-ask for input
total_suites += total # Calculating the total number of suites
total_occupied +=occupied # Calculating the total number of available suites
floor +=1 # increase the floor
occupancy = (total_occupied/total_suites) * 100
if occupancy < 50:
occup_status = "Poor Occupancy"
elif 50 <= occupancy <75:
occup_status = "Acceptable Occupancy"
else:
occup_status = "Excellent Occupancy"
print("Total Suites : "+str(total_suites))
print("Total Occupied Suites : "+str(total_occupied))
print("Occupancy Percentage : "+str(occupancy)+" % "+occup_status)
if __name__ == "__main__":
main()
Answers
Answered by
utata
it is showing error
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.