๋ด์ฅํจ์ ๋ณด์ถฉ
1. format์ผ๋ก ๋ฌธ์์ด ๋ง๋ค๊ธฐ
result = format(10000) #str(10000)๊ณผ ๊ฐ๋ค
print(type(result))
2. ์ฒ ๋จ์ ์ผํ
result = format(10000, ',')
print(result)
3. abs() ์ ๋๊ฐ
result = abs(10)
print(result)
result = abs(-10)
print(result)
4. max() ์ต๋๊ฐ ๋ฐํ
result = max(1,10)
print(result)
li = [5, 3, 7, 4, 2, 1]
result = max(li)
print(result)
5. min() ์ต์๊ฐ ๋ฐํ
result = min(li)
print(result)
6. pow() ๊ฑฐ๋ญ์ ๊ณฑ ํจ์
result = pow(10, 2)
print(result)
7. sorted() ํจ์ - ์ ๋ ฌ
my_li = [5, 6, 3, 4, 1, 2]
print(my_li)
result = sorted(my_li)
print(result)
result = sorted(my_li, reverse=True)
print(result)
8. zip() ํจ์ - ๊ฐ์ ์ธ๋ฑ์ค ๋ฒํธ๋ผ๋ฆฌ ํํ๋ก ๋ฌถ์ด ์ค๋๋ค.
names = ['james', 'emily', 'amanda']
scores = [60, 70, 80]
for student in zip(names, scores):
print(student)
for name, score in zip(names, scores):
print('{}์ ์ ์๋ {}์ ์
๋๋ค.'.format(name, score))
'๐์น ๊ฐ๋ฐ(Web) > ๐ํ์ด์ฌ(Python)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
join ๋ฉ์๋ /split ๋ฉ์๋ /replace ๋ฉ์๋ /strip(), lstrip(), rstrip() ๊ณต๋ฐฑ ์ ๊ฑฐ (0) | 2023.01.30 |
---|---|
ํ์ด์ฌ ๋ฉ์๋(method)/string๊ฐ์ฒด format ๋ฉ์๋/find ๋ฉ์๋/count ๋ฉ์๋/find ๋ฉ์๋/ index ๋ฉ์๋ (0) | 2023.01.30 |
ํ์ด์ฌ enumerate() ๋ด์ฅ ํจ์ (0) | 2023.01.30 |
ํ์ด์ฌ divmod() ํจ์ (0) | 2023.01.30 |
ํ์ด์ฌ eval ํจ์ (2) | 2023.01.30 |