[Python] Print series of prime numbers in python

Discussão em 'Python' iniciado por Stack, Agosto 23, 2025.

  1. Stack

    Stack Membro Participativo

    I was having issues in printing a series of prime numbers from one to hundred. I can't figure our what's wrong with my code.

    Here's what I wrote; it prints all the odd numbers instead of primes:

    for num in range(1, 101):
    for i in range(2, num):
    if num % i == 0:
    break
    else:
    print(num)
    break

    Continue reading...

Compartilhe esta Página