def cosec(): try: val = math.cosec(eval(equation.get())) except ValueError or ZeroDivisionError or SyntaxError or NameError: equation.delete(0, END) equation.insert(0, 'Invalid Input') err = messagebox.showwarning(title='Invalid Input', message='Please Input valid Syntax') if err == 'ok': equation.delete(0, END) else: equation.delete(0, END) equation.insert(0, val)
def cosec1(x): l=query.split("cosec of") c=[] for k in l: n='' for i in k: try: if int(i) in range(10): n=n+i except: pass c.append(n) q=math.cosec(int(c[1])) return q
def p_expresssion_unop(t): '''expression : LOG expression | TRIGO expression''' if 'log' in t[1].lower(): t[0] = math.log(t[2]) if 'sin' in t[1].lower(): t[0] = math.sin(math.radians(t[2])) if 'cos' in t[1].lower(): t[0] = math.cos(math.radians(t[2])) if 'tan' in t[1].lower(): t[0] = math.tan(math.radians(t[2])) if 'cosec' in t[1].lower(): t[0] = math.cosec(math.radians(t[2])) if 'cot' in t[1].lower(): t[0] = math.cot(math.radians(t[2])) if 'sec' in t[1].lower(): t[0] = math.sec(math.radians(t[2]))
def calculate(self, val): return self.coefficient * ((math.cosec(val))**self.power)
def cosec(self): self.current = float(self.current) self.current = float(math.cosec((self.current))) text_box.delete(0, END) text_box.insert(0, self.current) self.new_num = True
def cosec(self, exp): if self.rad: return round(math.cosec(exp), self.round_digit) else: return round(math.cosec(math.radians(exp)), self.round_digit)
def cosec_val(r): p = m.cosec(r) return p
#arithmetic operations print(10+3)#addition print(10/3)#Divison (gives result in float form) print(10//3)#Divison (gives result in int form) print(5%2)#Modulus (Gives remainder of divison) print(10**4)#Exponent print(10*5)#Multiplication print(100-45)#Subtraction x=10 x=x+3 #Long form x+=3 #Short form print(x) y=10+3*2**2#Operator precedence (Always follows BODMAS Rule print(y) z= (10+3)*2**2#Paranthesis takes importance first) a=2.9 print(round(a))#Rounding off print(abs(a))#Gives absolute value of numbers import math print(math.ceil(a))#prints ceiling of a number print(math.tan(a))#finds tan of any value print(math.cos(a))#finds cos of any value print(math.sin(a))#finds sin of any value print(math.cosec(a))#finds cosec of any value print(math.sec(a))#finds sec of any value