-3

this is my simple code for finding prime numbers

for pt in range(1,100):
   isp = 1
 for ts in range(1,100):
     if(pt%ts ==0):
         isp= 0 
         break 
         if(isp):
         print(pt)

this error

File "/storage/emulated/0/qpython/prime.py", line 3 for ts in range(1,100): ^ IndentationError: unindent does not match any outer indentation level

Ruben Helsloot
  • 12,582
  • 6
  • 26
  • 49

1 Answers1

0

You've both the syntax and logical errora. You can try this:

for pt in range(2, 100):
    isp = 1
    for ts in range(2, pt):
        if pt % ts == 0:
            isp = 0
            break
    if isp:
        print(pt)
Taohidul Islam
  • 5,246
  • 3
  • 26
  • 39