Basic Loop/Python
<p>I am supposed to write a program that displays numbers from 100 to 200, ten per line, that are divisible by 5 or 6 but NOT both. This is my code so far. I know it's a basic problem so can you tell me the basic code that I'm missing instead of the "shortcut" steps. Any help is appreciated!</p>

<pre><code>    def main():
      while (num &gt;= 100) and (num &lt;= 200):
      for (num % 5 == 0) or (num % 6 == 0)
        print (num)

    main()
</code></pre>

<p>You should init every variable using in the code
While (condition) will break when the condition false. Since your condition depends on num, but num is never changed in your code, infinity loop will happen. You need to add <code>num = num + 1</code> at the end of your loop block.
It's supposed to use if not for for each iterator here. And the condition you used for your problem is wrong to.</p>

<p>Should be like this:</p>

<pre><code>def main():
    num = 100
    while (num &gt;= 100) and (num &lt;= 200):
        if ((num % 5 == 0) or (num % 6 == 0)) and (num % 30 != 0):
            print (num)
        num = num + 1
main()
</code></pre>

python python-3.x