Im trying to check is the number passed is a valid perfect square by
return True if(math.sqrt(num)%2 == 0 or \
(math.sqrt(num)+1) % 2 == 0 ) else False
I want to know if I could write this better by breaking the if statement into two parts like
return True if(math.sqrt(num)%2 == 0)
elif ((math.sqrt(num)+1) % 2 == 0 )
else False
Could someone help me with how to use elif here or if there is a better approach.
Thank you.