알고리즘1 Alogrithm With Python # 짝수 홀수 구하기 def isOddEven(num): print(num ) if (num % 2 == 0): retVal = 'even' else: retVal = 'odd' return retVal result = isOddEven(121281817134343858590) print(result) # 좌표 평면 두점 사이의 거리를 구하는 알고리즘 import math def getDistance(p1, p2): xDistance = p1[0] - p2[0] print(xDistance) yDistance = p1[1] - p2[1] print(yDistance) #피타고라스정리에 의해 pDistance = math.pow(xDistance,2) + math.pow(yDistance,2) return.. 2021. 1. 9. 이전 1 다음