Call the length of the horizontal "leg" of the triangle a. Call the length of the vertical "leg" of the triangle b. In terms of the angle , what are the values for a and b?
Once you have that, notice that you have a right triangle. Apply the Pythagorean Theorem.
0 and 90 degrees are not included because with theta as zero degree or 90 degrees, you have no right triangle. There is already one 90-degree angle in the shown right triangle. The 3 interior angles are supposed to add up only to 180 degrees.
To picture the 0deg < theta < 90deg more, first make the theta in the figure approximately or about 5 degrees only, or 10 degrees, or dependending on how small it can get in your sketch.
The resulting triangle looks very flat, yet, still it is a right triangle and
sin^2(5deg) +cos^2(5deg) = 1 still.
Then make theta about 80 degrees. The resulting right triangle looks like a a tall pole. Yet, still, sin^2(80deg) +cos^2(80deg) = 1.
Get your calculator and check those.