title: How to find a certain amount of same adjacent elements in a row of a nested list
body: <p>There is a hotel e.g. of size 7x5. I need to create a function where</p>
  <ol>
  <li>a number is given as parameter for finding the amount of <strong>consecutive empty</strong> rooms</li>
  <li>returns the number of floor and room number in that.
  (depicted below: 0 is empty room and 1 is full)</li>
  </ol>
  <p><a href="https://i.stack.imgur.com/4VkO3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4VkO3.png" alt="enter image description here" /></a></p>
  <p>e.g.:</p>
  <ol>
  <li>if the parameter is 1, output will be
  &quot;floor no: 5, start from room no: 1&quot;</li>
  <li>if the parameter is 2, output will be
  &quot;floor no: 5, start from room no: 3&quot;</li>
  <li>if the parameter is 3, output will be
  &quot;floor no: 5, start from room no: 3&quot;</li>
  <li>if the parameter is 4, output will be
  &quot;floor no: 4, start from room no: 4&quot;</li>
  <li>if the parameter is 5, output will be
  &quot;floor no: 2, start from room no: 1&quot;</li>
  <li>if the parameter is 6 (or 7), output will be
  &quot;floor no: 1, start from room no: 1&quot;</li>
  <li>if the parameter is &gt; 7, output will be
  &quot;not possible to find in one floor&quot;</li>
  </ol>
  <p>preferably without using itertools.grupby.</p>
  <p>My try:</p>
  <pre><code>def adjacent_rooms (amount):
      nested_list_temp = [[0]*7]*5
      nested_list = [list(i) for i in nested_list_temp]
      nested_list [1][5] = 1
      nested_list [2][3] = 1
      nested_list [2][4] = 1
      nested_list [3][2] = 1
      nested_list [4][1] = 1
      nested_list [4][5] = 1
      # [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0]]
      try:
          for i in range(len(nested_list), 0, -1):
              for j in range(len(nested_list[0])):
                  if nested_list[i-1][j] == 0:
                          count += 1
                          if count == amount:
                              return (i, j-amount+2)
                          else:
                              count = 0
      except:
          return &quot;not possible to find in one floor&quot;
  
  </code></pre>
  <p>Any effective hints or suggestions will be highly appreciated.</p>