So I have an assingment that I am stuck on -_-
So I am supposed to create a code that "tests" out a range of integers and determine the perfect squares(4,16,25, etc) within the range without using square root calculations and using a function. I have written the following, and after staring at it for 4 hours, I can't find my mistake in generating the squares.
Any help would be appreciated ^^
import sys
def squares(num):
i = 1
s = 0
while s <= num :
s = (i * i)
i = i + 1
return s
start = input ("Enter a starting value: ")
stop = input ("Enter an ending value: ")
if start < 1 :
print ("Starting value is too low")
exit()
else :
num = start
while num <= stop:
squares(num)
if num == squares(num):
print squares(num)
else :
num = num
num = num + 1