I don't know for sure, but the issue is probably that either degrees or float(0) is returning something like 0.0002 instead of 0, which is causing the condition to fail. This issue occurs because of floating point precision.
The way I have found to work around the issue is to multiply the angle by 100, use the round function to remove the floating points, cast the rounded result to an integer to get rid of the floating point precision issue, and finally divide the result by 100 so that the angle is back to a decimal. The code for this looks like this:
angle_to_convert = int(round(angle_to_convert * 100)) / 100.0;
This will work around the floating point precision issue, as numbers like 0.0002 will be converted to 0.00, dropping the two entirely.
If your angle is in the -180 to 180 range, converting it to 0 to 360 depends on where you want 0 rotation to be. For my projects, I just check if the angle is under 0 and if it is, I take 360 and add the rotation to it. Because the rotation is negative, this will remove from 360, leading to the angle getting progressively larger as the negative angle gets smaller.
That will change the angle range so it is within 0 to 360, where 0 is in the same position as the Godot editor.
Hopefully this helps!