728x90
import math
print(math.sin(1))
print(math.cos(1))
print(math.tan(1))
print(math.floor(2.5)) # ๋ด๋ฆผ
print(math.ceil(2.5)) # ์ฌ๋ฆผ
# ์ฌ์ฌ์ค์
์์น. ๋ฐ์ฌ๋ฆผํ ์๋ฆฌ์ ์๊ฐ 5์ด๋ฉด ๋ฐ์ฌ๋ฆผํ ๊ฒฝ์ฐ ์์๋ฆฌ๊ฐ ์ง์๋ฉด ๋ด๋ฆผ, ํ์๋ฉด ์ฌ๋ฆผ
print(round(1.5))
print(round(2.5))
print(round(3.1415, 2))
print(round(31.415, -1))
import random
print(random.random()) # 0.0 <= r < 1.0
# uniform
print(random.uniform(10, 20)) # 10.0 ~ 19.99
print(random.randrange(10)) # 0 ~ 9
print(random.randrange(1, 5)) # 1 ~ 4
print(random.randint(1, 5)) # 1 ~ 5
print(random.choice([11, 33, 55, 7, 9]))
# shuffle
listA = [1, 2, 3, 4, 5]
random.shuffle(listA)
print(listA)
# sample
print(random.sample([1, 2, 3, 4, 5], k=5))
'๐ ํ์ด์ฌ Python' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
ํ์ด์ฌ - function (0) | 2021.06.29 |
---|---|
ํ์ด์ฌ - ๊ฐ์ ๋ฐ์ ๋ณด Program ๋ง๋ค๊ธฐ (0) | 2021.06.28 |
ํ์ด์ฌ - Dictionary (0) | 2021.06.28 |
ํ์ด์ฌ - list, tuple (0) | 2021.06.27 |
ํ์ด์ฌ - Datetime & if ์กฐ๊ฑด๋ฌธ (0) | 2021.06.26 |
๋๊ธ