#!/usr/bin/python3

"""
ΑΣΚΗΣΗ 14
Γράψτε πρόγραμμα το οποίο ζητάει μια γωνία θ στο διάστημα (0,π/2) και συνάρτηση που τυπώνει τους sinθ, cosθ, tanθ στη μορφή:
theta = 0.5235987755982988
sin(theta) = 0.8660254037844386
cos(theta) = 0.5000000000000000
tan(theta) = 1.7320508075688767
"""

import math

def trig(theta):
	print(f"theta = {theta:.16f}")
	print(f"sin(theta) = {math.sin(theta)}",f"cos(theta) = {math.cos(theta)}",f"tan(theta) = {math.tan(theta)}", sep="\n")

def main():
	theta=None
	try:
		while True:
			theta=float(input("Give theta in (0,π/2) : "))
			if not(0<theta<math.pi/2):
				print("theta must be in (0,π/2)")
				continue
			break
	except Exception as e:
		print(f"Exception: {str(e)}")
		exit(1)

	trig(theta) #:.16f είναι η προεπιλογή

if __name__=="__main__":
	main()
