Compiling successfully but not able to give output

@author: Sahil
“”"
import random
class room(object):
def init(self):
self.locondt = {‘A’:‘0’,‘B’:‘0’}
self.locondt[‘A’] = random.randint(0, 1)
self.locondt[‘B’] = random.randint(0, 1)
class VacuumAgent(room):
def init (self,room):
print(room.locondt)
place=0
vacuumlocation = random.randint(0,1)
if vacuumlocation == 0:
print(“Vacuum Cleaner is randomly placed at room A.”)
if room.locondt[‘A’]==1:
print(“Room A is dirty.”)
if room.locondt[‘A’]== 0:
place +=1
print(“Room A has been cleaned”)
print(“Now moving to room B”)
place -=1
if room.locondt[‘B’] ==1:
print(“Room B is dirty.”)
if room.locondt[‘B’] ==0:
place +=1
print(“Room B has been cleaned.”)
else:
place -=1
print(“Now moving to room B”)

                         if room.locondt['B'] == 1:
                             
                             print("Room B is dirty.")
                             if room.locondt['B'] ==0:
                                 place +=1
                                 print("Room B has been cleaned.")             
     elif vacuumlocation == 1:
         print("Vacuum Cleaner is randomly placed at room B.")                  
         if room.locondt['B'] == 1:             
             print("Room B is dirty.")                    
             room.locondt['B'] = 0;             
             place += 1             
             print("Room B has been Cleaned.")             
             place -= 1             
             print("Now moving to room A.")             
             if room.locondt['A'] == 1:                 
                 print("Room A is Dirty.")                                  
                 room.locondt['A'] = 0;                 
                 place += 1                 
                 print("Room A has been Cleaned.")         
             else:
                 
                 print("Now moving to room B")             
                 place -= 1                          
                 if room.locondt['A'] == 1:
                     print("Room A is dirty.")                                
                     if room.locondt['A'] == 0:
                         place += 1                 
                         print("Room A has been Cleaned.")          
                         print(room.locondt)     
                         print("Performance Measurement: " + str(place))

theroom = room()
thevacuum = VacuumAgent()

The following things need to be added to your post:

  1. Formatting your code. It is: ``` before and after your code
  2. Problem Link. Without this, no one can help you
  3. A brief explanation of what you want to do in the code(For example which algorithm you are using…what are you searching etc)
1 Like

You have not submitted any solution so i am just assuming you tried to run it on codechef ide.
i guess you had not given input in input box.