Convert Vba Primes to Python Primes - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Convert Vba Primes to Python Primes (/thread-9590.html) |
Convert Vba Primes to Python Primes - jackhj - Apr-17-2018 codeNUMBEROFPRIMES = 100 NUMBEROFPRIMESPERLINE = 10 count = 0 number = 2 while (count < NUMBEROFPRIMES): isPrime = True divisor = int divisor = 2 for divisor in range(2,int(number/2)): If (number % divisor) == 0 isPrime = False break if isPrime: count = count + 1 print(number) if (count % NUMBEROFPRIMESPERLINE) == 0: print(number/n) number = number + 1what is wrong with code? RE: Convert Vba Primes to Python Primes - Larz60+ - Apr-18-2018 for divisor in range(2,int(number/2)):first time fails, range (2, 1) also NUMBEROFPRIMES is not defined, codeNUMBEROFPRIMES is |