Skip to content

Instantly share code, notes, and snippets.

@anadimisra
Created December 15, 2017 05:45
Show Gist options
  • Save anadimisra/b80642c09a8840fab515c47b1deb21f5 to your computer and use it in GitHub Desktop.
Save anadimisra/b80642c09a8840fab515c47b1deb21f5 to your computer and use it in GitHub Desktop.
parking_lot_zeomega
import unittest
class ParkingLotTest(unittest.TestCase)
def test_create_parking():
lot = ParkingLot()
lot.create_parking_lot(6)
self.assertEqual(6, lot.get_size())
def test_find_slot(self):
lot = ParkingLot()
lot.create_parking_lot(6)
slot = lot.find_availabel_slot()
self.assertEqual(1, slot)
class ParkingLot(object)
slot_obj = []
size = 0
current.size = 0
def create_parking_lot(self, size):
self.size = size
i = 0
while(i < self.size):
i +=1
self.slot_ob[i] = {}
def find_availabel_slot(self)
if self.current_size == 0
return self.current_size
else:
for key, value in slot_obj.iteritems():
if slot_obj[key] == {}:
return key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment