title: Nested if statements in while loop
body: <pre><code>mean = &quot;Test&quot;
  
  while mean.isalpha():
      mean = input(&quot;Please enter the Mean (Value must be between minus infinity (–∞) and plus infinity (+∞)): &quot;)
      if mean == &quot;&quot;:
          mean = 0
          break
      elif mean.isdigit():
          mean = float(mean)
          if mean &lt;= 0:
              print(&quot;Error&quot;)
  
  print(mean)
  </code></pre>
  <p>Could someone kindly explain to me why does my if statement in the elif loop not work? Also, why do I need a break in my first if statement.</p>