ํŒŒ์ด์ฌ

1.ComprehensionList , Dictionary๋“ฑ์„ ๋น ๋ฅด๊ฒŒ ๋งŒ๋“œ๋Š” ๊ธฐ๋ฒ•์œผ๋กœ for + append๋ณด๋‹ค ์†๋„๊ฐ€ ๋น ๋ฅด๋‹ค. if ๋ฌธ์„ ๋„ฃ์–ด ์›ํ•˜๋Š” ์š”์†Œ๋งŒ ์ถ”๊ฐ€ ๊ฐ€๋Šฅ ๊ฒน for ๋ฌธ ์‚ฌ์šฉ ๊ฐ€๋Šฅ ๋‹ค์ฐจ์› ๋ฐฐ์—ด์„ ๋งŒ๋“ค๊ธฐ์— ๋งค์šฐ ์œ ์šฉ (๋‹จ, ์ตœ์ ํ™” ํ•  ๋•Œ ์‚ฌ์šฉ → ๋ณต์žกํ•ด์ง€๋ฉด ๊ฐ€๋…์„ฑ์ด ๋–จ์–ด์ง€๊ธฐ ๋•Œ๋ฌธ) evens = [ i for i in range(100) if i % 2 == 0 ] #if ์กฐ๊ฑด์ด ๋“ค์–ด๊ฐ„ comprehensionresult = [(i,j) for i in range(5) for j in range(i)] #๊ฒน for๋ฌธ2.Generatorrange ํ•จ์ˆ˜์˜ ๊ฒฝ์šฐ ์ˆซ์ž๋ฅผ ํ•˜๋‚˜์”ฉ ์ƒ์„ฑํ•˜์—ฌ ๋ฐ˜ํ™˜ํ•œ๋‹ค. ์ด์™€ ๊ฐ™์ด ์š”์†Œ๋ฅผ ํ•˜๋‚˜์”ฉ ์ƒ์„ฑํ•˜์—ฌ ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ฐ์ฒด๋ฅผ Generator๋ผ๊ณ  ํ•œ๋‹ค. function์—์„œ yi..
1. Call by Assignment(Call by Object Reference)๋ž€ ? python์€ ํ•จ์ˆ˜์— ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์ „๋‹ฌํ•  ๋•Œ Call by Assignment ๋ฐฉ์‹์œผ๋กœ ์ „๋‹ฌ๋œ๋‹ค. ์ด๋Š” ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ „๋‹ฌ๋ฐ›๋Š” ๊ฐ์ฒด์— ๋”ฐ๋ผ ๊ฐ์ฒด์˜ ์ฐธ์กฐ ๋ฐฉ์‹์ด ๊ฒฐ์ •๋œ๋‹ค๋Š” ์˜๋ฏธ์ด๋‹ค. 2. ์šฐ์„  ํŒŒ์ด์ฌ์˜ ๊ฐ์ฒด(object)์— ๋Œ€ํ•˜์—ฌ ํŒŒ์ด์ฌ์€ ๋ชจ๋“  ๊ฒƒ์ด ๊ฐ์ฒด(Object)์ด๋‹ค. a = 10 ํŒŒ์ด์ฌ์—์„œ๋Š” a ์— 10์ด ํ• ๋‹น๋˜๋Š” ๊ฒƒ์ด ์•„๋‹Œ, a ๊ฐ€ 10์ด๋ผ๋Š” ์ƒ์ˆ˜ ๊ฐ์ฒด๋ฅผ ์ฐธ์กฐํ•˜๋Š” ๊ฒƒ์ด๋‹ค. 3. mutable vs immutable python์—์„œ๋Š” ๋ชจ๋“  ๊ฒƒ์ด ๊ฐ์ฒด์ด๋ฉฐ 2๊ฐ€์ง€ ์ข…๋ฅ˜๋กœ ๋‚˜๋‰œ๋‹ค. immutable : ๊ฐ’ ๋ณ€๊ฒฝ์ด ๋ถˆ๊ฐ€๋Šฅํ•œ ๊ฐ์ฒด int, float , str ,tuple , bool ..๋“ฑ mutable : ๊ฐ’ ๋ณ€๊ฒฝ์ด ๊ฐ€..
๐Ÿ’ก ๋ณธ ํฌ์ŠคํŒ…์€ ๋‹ค์Œ ํ•™์Šต์ž๋ฃŒ๋ฅผ ์ฐธ๊ณ ํ•œ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค. https://wikidocs.net/28 05-1 ํด๋ž˜์Šค ์ดˆ๋ณด ๊ฐœ๋ฐœ์ž๋“ค์—๊ฒŒ ํด๋ž˜์Šค(class)๋Š” ๋„˜๊ธฐ ํž˜๋“  ์žฅ๋ฒฝ๊ณผ๋„ ๊ฐ™์€ ์กด์žฌ์ด๋‹ค. ๋…์ž๋“ค ์ค‘์—๋„ ํด๋ž˜์Šค๋ผ๋Š” ๋‹จ์–ด๋ฅผ ์ฒ˜์Œ ์ ‘ํ•˜๋Š” ์ด๋“ค์ด ์žˆ์„ ๊ฒƒ์ด๋‹ค. ๊ทธ๋Ÿฌ๋ฉด ๋„๋Œ€์ฒด ํด๋ž˜์Šค๊ฐ€ ๋ฌด์—‡์ธ์ง€, ํด… wikidocs.net 1. ํด๋ž˜์Šค(Class) ๊ฐ์ฒด๋ฅผ ๋งŒ๋“ค์–ด๋‚ด๊ธฐ ์œ„ํ•œ ์„ค๊ณ„๋„ or ํ‹€ ex) ๊ณผ์ž ํ‹€ 2. ๊ฐ์ฒด(object) ํด๋ž˜์Šค๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๊ตฌํ˜„๋œ ๊ตฌ์ฒด์ ์ธ ์‹ค์ฒด `ํด๋ž˜์Šค์˜ ์ธ์Šคํ„ด์Šค(instance)`๋ผ๊ณ ๋„ ๋ถ€๋ฅธ๋‹ค. ex) ๊ณผ์ž ํ‹€๋กœ ์ฐ์–ด๋‚ธ ๊ณผ์ž ์ฆ‰, ๊ฐ์ฒด(object)๋ฅผ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•œ ์„ค๊ณ„๋„์™€ ๊ฐ™์€ ๊ฐœ๋…์„ ํด๋ž˜์Šค(class)๋ผ๊ณ  ํ•œ๋‹ค. 3. ๋ฉ”์„œ๋“œ(Method) ํด๋ž˜์Šค ์•ˆ์— ๊ตฌํ˜„๋œ ํ•จ์ˆ˜ ํŒŒ์ด์ฌ ๋ฉ”์„œ๋“œ์˜ ์ฒซ ๋ฒˆ์งธ..
zzoming_00
'ํŒŒ์ด์ฌ' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก