I want to print a series of prime numbers from one to a hundred. Here is what my code looks like:

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

It prints all the odd numbers instead of primes. Can someone help me with the code?

Apr 25, 2022 in Python 410 views

## How to print square of first 100 natural numbers using iterations in python?

Can you make a program with nested ...READ MORE

## Sum of prime numbers from m to n in python

def is_prime(number):     if number < 2:         return False     for i ...READ MORE

## What is the algorithm to find the sum of prime numbers in the input in python

To find the sum of prime numbers ...READ MORE

+1 vote

## How to print first character of each word in upper case of a string in Python

class Solution:     def firstAlphabet(self, s):             self.s=s              k=''              k=k+s[0]              for i in range(len(s)):                     if ...READ MORE

## Print the odd and even factors of a number in Python

x = int(input("Enter any number \n")) print("The factors ...READ MORE

## How to print objects of class using print function in Python?

>>> class Test: ... ...READ MORE

## how do i change string to a list?

suppose you have a string with a ...READ MORE

## how can i randomly select items from a list?

You can also use the random library's ...READ MORE

+1 vote