def Squares(a, b):
for i in range (a, b + 1):
j = 1;
while j * j <= i:
if j * j == i:
yield j*j
j = j + 1
i = i + 1
a = int(input("Enter lower bound:"))
b = int(input("Enter upper bound:"))
x = [v for v in Squares(a,b)]
if x:
print(min(x))
else:
print("No perfect square")
Comments
Leave a comment