title: program to find the sum of the first N odd numbers
body: <p>I'm trying to make a program that calculates the sum of the first N odd numbers. where N is the number of the first odd numbers (e.g. N=4, then the first odds are 1,3,5,7)</p>
  <p>it should output the odd numbers.</p>
  <p>is the code correct? (given that it needs to be in a loop) or is there a better code for calculating the sum?
  Also, how to input validate negative numbers? I only know how to do it for integers. (the input needs to be only positive integers)</p>
  <pre><code>numberN=input(&quot;Please enter a positive number N: &quot;)
  sumofodd = 0
  try:
      digit = int(numberN)
      if digit &gt; 0:
          for n in range (0,digit+1,1):
              sumofodd = n*n
          print(&quot;the sum of&quot;, digit, &quot; is &quot;, sumofodd)
  except ValueError: 
      print(&quot;you did not enter a positive integer&quot;)
      exit(1)
  </code></pre>
  <p>Thank you very much</p>