def cos(var_1): """ Return a Cosine for angle. :param var_1: int or float as "Angle in degrees" :return: int or float """ return mycos(var_1)
# import math # print(math.sin(math.pi/4),math.cos(math.pi/4)) # 특정 함수만 사용할 때 # from math import sin,cos,pi # print(sin(pi/4),cos(pi/4)) # from math import sin,cos,pi # from mymath import pi # 덮어버린다. # print(sin(pi/4),cos(pi/4)) # print(pi) # 정말 비추... # from math import * # print(sin(pi/4),cos(pi/4)) # 추천 # import math as m # import math # print(m.sin(m.pi/4),m.cos(m.pi/4)) # print(m.pi) from math import sin as mysin, cos as mycos, pi as mypi print(mysin(mypi / 4), mycos(mypi / 4))
# 다양한 import 방법 # Way 1. # import math # print(math.sin(math.pi/6), math.cos(math.pi/6)) # Way 2. # 같은이름의 모듈을 사용할 경우 마지막꺼로 덮히게 된다. [alias로 해결가능] # from math import pi, sin, cos # from mymath import pi # print(sin(pi/6), cos(pi/6)) # Way 3. # from math import * # import mymath as m # print(sin(pi/6), cos(m.pi/6)) # Way 4. from math import sin as mysin, cos as mycos from mymath import pi print(mysin(pi / 6), mycos(pi / 6))
# 다양한 import 방법 # import math # print(math.sin(math.pi/6), math.cos(math.pi/6)) # from math import pi, sin, cos # from mymath import pi # print(sin(pi/6), cos(pi/6)) # print(pi) # from math import * # import mymath as m # print(sin(pi/6), cos(pi/6)) # print(m.pi) from math import sin as mysin, cos as mycos import mymath as m print(mysin(m.pi / 6), mycos(m.pi / 6))
from math import pi, sin, cos, tan print(sin(pi / 6), cos(pi / 3), tan(pi / 4)) print() from math import sin, cos, tan from module.mymath import pi # 현재 모듈에 특정이름이 중복되는 경우 맨 마지막이 덮어쓰게 된다 print(sin(pi / 6), cos(pi / 3), tan(pi / 4)) print() from math import * #math 모듈에정의된 모든이름을 현재 모듈로 가져오기 print(sin(pi / 6), cos(pi / 3), tan(pi / 4)) print() from math import * from module import mymath as m print(sin(pi / 6), cos(pi / 3), tan(pi / 4)) print(m.pi) print() from math import sin as mysin, cos as mycos, tan as mytan import module.mymath as m print(mysin(m.pi / 6), mycos(m.pi / 3), mytan(m.pi / 4))
# import math # print(math.sin(math.pi/6), math.cos(math.pi/4)) # from math import sin, cos, pi # from mymath import pi # print(sin(pi/6), cos(pi/4)) # print(pi) # from math import * # 이거 완전 비 추 ! 이름관리가 안됨 # print(sin(pi/4), cos(pi/4)) # from mymath import pi as mypi # import math as m # print(m.sin(m.pi/4)) # print(mypi.pi) import math from math import sin as mysin, cos as mycos, pi as mypi print(mysin(math.pi / 4), mycos(math.pi / 4))