Python 숫자 관련 함수

sunj - May 9 - - Dev Community
#반올림 : round(a), round(a,b)

print(round(3.33))  #3
print(round(3.66)) #4
#소수점 몇번째 자리 까지 반올림해라 
print(round(3.66,1)) #3.7 
Enter fullscreen mode Exit fullscreen mode
#절대값 : abs(a)
print(abs(3)) #3 
print(abs(-3)) #3
Enter fullscreen mode Exit fullscreen mode
#제곱 : pow(a,b)
print(pow(3,2)) #9
print(3**2) #9
Enter fullscreen mode Exit fullscreen mode
#나눗셈 : divmod(a,b)
x,y=divmod(7,2) #첫번째 몫, 두번째 나머지
print(x)
print(y)
Enter fullscreen mode Exit fullscreen mode
#최대값 : max(a,b,c,d,...)
print(max(7,5,1,3)) # print(max([7,5,1,3]))

#최소값 : min(a,b,c,d,...)
print(min(7,5,1,3)) # print(max([7,5,1,3]))
Enter fullscreen mode Exit fullscreen mode
#합 : sum(집합형태 : Iterable)
print(max([7,5,1,3])) #리스트, 튜플 등등
Enter fullscreen mode Exit fullscreen mode

참조 : 유투브 소놀코딩

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player