The slope as a percentage is calculated from slope = 100 x rise/run, where "run" is the horizontal distance covered. This is equivalent to saying that slop= tangent of the angle to the horizontal expressed as a percentage. In your example the slope would be 100 x 5/10 = 50%. A slope of 100% is equivalent to a 45 degrees, and slope greater than 100% means the angle is greater than 45 degrees.

In some cases you may need to calculate the "run" distance using the Pythagorean theorem. If the length of the string in your example is known to be 10, and the drop is known to be 5, then the horizontal run is:

run=sqrt(10^2-5^2) = 8.66,

and the slope is then 100 x 5/8.66 = 57.7%. For "reasonable" values of slope such as engineers might use for calculating slope on a roadway (typically less than 10%) it's usually "good enough" to use slope = rise/string length and not bother calculating horizontal run.