โญโโญโ๐ฅ๐๐ตโ โ
print('์ด์ฉ๊ตฌ')
pass
print('์ด์ฉ๊ตฌ')
try-except: validation์ ๋ง์ด ์ฌ์ฉ
try-except-except... ์ฌ๋ฌ๊ฐ ์ฌ์ฉ ๊ฐ๋ฅ(if else ๊ตฌ๋ฌธ์ฒ๋ผ)
stacktrace: ์๋ฌ๊ฐ ๋๋ ๊ณผ์ ์?(ํธ์ถ๋ ํจ์์ ๋ชฉ๋ก) ๋ณผ ์ ์๋น
์ถ์ฝ์: [x(:"value") for x in range(10)]->()๋ถ๋ถ์ ๋์
๋๋ฆฌ์ผ๋
for ์ ๋ถ๋ถ์ด ์ค์ ๋ฆฌ์คํธ์ ๋ด๊ธฐ๋ ๊ฐ
python module์ด๋ฆ document -> ์ฌ๊ธฐ์ ๋ฐ๋ผ ์ฐ๋ ๊ฒ ๊ฐ์ฅ ์ข์
iterable: ๋ฐ๋ณต๋ฌธ์์ ์ฌ์ฉ ๊ฐ๋ฅํ ์๋ฃํ
map์ ๋ฆฌ์คํธ ์ถ์ฝํ์ผ๋ก ๋์ฒด ๊ฐ๋ฅํ๋ค
numbers=[1,2,3,4,5]
list(map(lambda x:x*2,numbers))
list_=[x*2 for x in numbers]
even_numbers = list(filter(lambda x: x%2==0, numbers))
even_numbers = [x for x in numbers if x%2 == 0]
people = [{"lee":32},{"kim":23}]
people = [x for x in people if x[1]>=30]
-> people[1]์ด ์๋๋ผ x[1]์! x๋ ๋์ ๋๋ฆฌ โ
people.sort(key=lambda x: x[1])
#x[1]์ด ์ ๋ ฌ์ ๊ธฐ์ค์ด ๋จ
#[('ko', 22), ('kim', 23), ('lee', 32), ('kim', 90)]
people.sort(key=lambda x: x[1],reverse=True)
#๊ฑฐ๊พธ๋ก ์ ๋ ฌ
#[('kim', 90), ('lee', 32), ('kim', 23), ('ko', 22)]
people.sort(key=lambda x: (x[0],x[1]))
#x[0]์ด ์ฐ์ ์์, ๊ฐ์ผ๋ฉด x[1]๊ธฐ์ค ์ ๋ ฌ
from pprint import pprint
people_over_20 = [x for x in people if x[2]> 20]
people_over_20_sorted = people_over_20.sort(key = lambda x : x[2])
pprint(people_over_20)
#์ ์ ๋ ฌ ๋์ด์ ์ถ๋ ฅ๋จ
pprint(people_over_20_sorted)
#none
text = 'this is a textabcabc'
print(text.replace('abc','',3))
#this is a text
print(text.replace('abc',''))
#this is a text
print(text)
#this is a textabcabc
-> ๋ค์ ์ซ์ 3์ด ์นํํ์ ์์ฐ๋ฉด ๊ทธ๋ฅ ๋ค ์์ ๋ฒ๋ฆผ!!
croatian_word = input()
croatian_letters = ['c=','c-','dz=','d-','lj','nj','s=','z=']
korean_letters = ['ใฑ','ใด','ใท','ใน','ใ
','ใ
','ใ
','ใ
']
for i in range(len(croatian_letters)):
if croatian_letters[i] in croatian_word:
croatian_word = croatian_word.replace(croatian_letters[i],korean_letters[i])
print(len(croatian_word))
-> ์ฒ์์ ํ๋ฆฐํธํ์ ๋ ํ๋์ฉ๋ง ๋ฐ๋์ด์ ๋์์ ??ํ๋๋ฐ ๊ทธ๊ฑธ ๊ทธ๋ฅ ์๋ ๋ณ์์ ๋ฃ์ด์ฃผ๋ฉด ๋๋ ๊ฑฐ์๋น ใ ใ ๊ทธ๋ผ ๋ฐ๋ ๋ค์์ ๋ ๋์ฒดํ๋ฌ ๋ค์ด๊ฐ๋๊น! ๋ฌธ์๋ฅผ ๋์ฒดํ๋๊ฒ ์์ด๋ ๊ฒ ์๊ฐ์ด ์๋๋์ง.. ๊ทธ๋๋ ์๊ฐ๋์ ๋คํ๋คํ