title: Why is PyCharm saying a section of my code within a funciton is unreachable, despite it is working as intended?
body: <p>I have this code that checks internet connection and sets a boolean accordingly.  I've put the code in a function.  But PyCharm is showing that this line:  &quot;start_time = time.time()&quot; is unreachable.  Did I write my code wrong?</p>
  <p>Screenshot:  <a href="https://i.stack.imgur.com/Od56E.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Od56E.jpg" alt="pic of warning" /></a></p>
  <p>The code:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>from time import time, sleep
  import os
  
  
  def something():
      while True:
          sleep(2 - time() % 2)
          ip_list = ['8.8.8.8']
          for ip in ip_list:
              response = os.popen(f"ping {ip}").read()
              if "Received = 4" in response:
                  print(f"UP {ip} Ping Successful")
                  _connected = True
                  print(_connected)
              else:
                  print(f"DOWN {ip} Ping Unsuccessful")
                  _connected = False
                  print(_connected)
  
  
      start_time = time.time()
  
      seconds = 1
  
      while True:
          current_time = time.time()
          elapsed_time = current_time - start_time
  
          if elapsed_time &gt; seconds:
              print("Finished iterating in: " + str(int(elapsed_time)) + " seconds")
              break
  
  
  something()</code></pre>
  </div>
  </div>
  </p>
  <p>My end goal here is to understand why PyCharm would call this warning.  It seems to me that everything is correct.</p>