#! /usr/bin/python3 # =================================================================== # test the trigonometric sine function # =================================================================== import numpy as np import sys import user_interface as ui # ------------------------------------------------------------------- # ---- main # ------------------------------------------------------------------- if __name__ == '__main__': if not ui.running_python3(): print() print('Must run Python3') sys.exit() while True: print() a = ui.get_user_input('Enter an angle (degrees): ') if not a: # empty string? print() break if not ui.is_a_number(a): # number? print() print('Error: Bad input') continue deg = float(a) % 360.0 # degrees rad = np.deg2rad(deg) # radians print() print(f'deg: {deg}') print(f'rad: {rad}') print(f'sin: {np.sin(rad)}')