Perfect Squares in a Range
This Program name is Perfect Squares in a Range. Write a Python program to Perfect Squares in a Range, it has two test cases
The below link contains Perfect Squares in a Range question, explanation and test cases
https://drive.google.com/file/d/1Eop1B9ddIWooAOyPsKrtt-1noUCRCSa4/view?usp=sharing
We need exact output when the code was run
import math
A=int(input())
B=int(input())
numberPerfectSquares=0
for number in range(A,B+1):
root = math.sqrt(number)
if int(root + 0.5) ** 2 == number:
numberPerfectSquares+=1
print(numberPerfectSquares)
Comments
Leave a comment