0

For example, I put this:

for i in range (2,n**0.5+1,2):

      print(i)

And it doesn't work. I tried putting 1/2 instead but it didn't work I have python 3.6

python-help
  • 1
  • 1
  • 3

1 Answers1

2

Unfortunately, range only accepts integers. But you can use this function instead:

def frange(start, stop, step):
    current = start
    while current < stop:
        yield current
        current += step
leovp
  • 4,528
  • 1
  • 20
  • 24