๐Ÿ“’ Today I Learn/๐Ÿ‘พ Error

240612 Today I Learn๐Ÿ‘พ ModuleNotFoundError: No module named 'tensorflow.keras'์‚ฌ์šฉํ•˜๋ ค๋Š” ๋ชจ๋“ˆ์„ ์ฐพ์„ ์ˆ˜ ์—†๋‹ค. ์ด ๊ฒฝ์šฐ 'tensorflow.keras'๋ผ๋Š” ๋ชจ๋“ˆ์„ ์ฐพ์„ ์ˆ˜ ์—†๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธ๋ฌธ์ œ์ƒํ™ฉ tensorflow.keras๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ๊ณผ์ •์—์„œ module์„ ์ฐพ์„ ์ˆ˜ ์—†๋‹ค๋Š” ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.  ๋ฌธ์ œํ•ด๊ฒฐ์„ ๋„์™€์ฃผ์‹  ํŠœํ„ฐ๋‹˜๊ป˜์„œ ๋ง์”€ํ•˜์‹œ๊ธธ.. keras๋ฅผ ์ด์šฉํ•  ๋•Œ ์ด๋Ÿฌํ•œ ์˜ค๋ฅ˜๋ฅผ ๊ฒช๋Š” ์ผ€์ด์Šค๊ฐ€ ๋งŽ๋‹ค๊ณ  ํ•œ๋‹ค. ๋Œ€๋ถ€๋ถ„์˜ ๊ฒฝ์šฐ, from tensorflow.python.keras.datasets  ์ด๋ ‡๊ฒŒ ์ค‘๊ฐ„์— ํŒŒ์ด์ฌ์ด๋ผ๋Š” ๊ฒฝ๋กœ๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด ํ•ด๊ฒฐ๋œ๋‹ค๊ณ  ํ•˜๋Š”๋ฐ ์ด ๋ฐฉ๋ฒ•์œผ๋กœ ํ•ด๊ฒฐ์ด ๋˜์ง€ ์•Š๋Š” ๋‹ค๋ฉด ์•„๋ž˜์˜ ๊ธ€์ด ๋„์›€์ด ๋  ๊ฒƒ ๊ฐ™๋‹ค. ๐Ÿ” ์—๋Ÿฌํƒ์ƒ‰Modul..
240513 Today I Learn๋ฌธ์ œ์ƒํ™ฉ  ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”.programmers.co.krdef solution(nums): answer = [] for i in range(0, len(nums)): for j in range(i+1, len(nums)): for k in range(j+1, len(nums)): answer.append(nums[i]+nums[j]+nums[k]) for n in answer: cnt = [] ..
240510 Today I Learn๐Ÿ‘พ UnboundLocalError: local variable referenced before assignmentํ•จ์ˆ˜ ๋ฐ–์—์„œ ์„ ์–ธํ•œ ๋ณ€์ˆ˜(Global Variable)๋ฅผ ํ•จ์ˆ˜ ๋‚ด(Local Variable)์—์„œ ์‚ฌ์šฉ/๋ณ€๊ฒฝ ํ–ˆ์„ ๋•Œ ๋ฐœ์ƒํ•˜๋Š” ์—๋Ÿฌ๋ฌธ์ œ์ƒํ™ฉ ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”.programmers.co.krdef solution(answers): tf={} answer = {'1':cnt1, '2':cnt2, '3':cnt3} math = {'1' :[1,2,3,4,5],'2':[2,1,2,3,2,4,2,5], '..
240507 Today I Learn๐Ÿ‘พ IndexError: list index out of range์ธ๋ฑ์Šค ์—๋Ÿฌ : ๋ฆฌ์ŠคํŠธ ์ธ๋ฑ์Šค๊ฐ€ ๋ฒ”์œ„๋ฅผ ๋ฒ—์–ด๋‚จ ๋ฌธ์ œ ์ƒํ™ฉdef solution(cards1, cards2, goal): for i in goal: if i == cards1[0]: cards1.pop(0) elif i == cards2[0]: cards2.pop(0) else: return 'No' return 'Yes' โ–ถ๏ธŽ ์˜ค๋ฅ˜ test casecards1cards2goalresult["i", "water", "drink"]["want", "to"]["i", "want", "to", "drin..
240415 Today I Learn์—๋Ÿฌ ์ฝ”๋“œ์— ๋Œ€์‘ํ•˜๊ธฐError [1406][22001]: Data truncation: Data too long for column '์ฃผ์š”์‹๋ฌผ' at row 109๋„ฃ๊ณ ์ž ํ•˜๋Š” ๋ฐ์ดํ„ฐ์˜ ํฌ๊ธฐ๊ฐ€ Column์— ์„ค์ •๋œ ํฌ๊ธฐ๋ณด๋‹ค ํด ๋•Œ ๋ฐœ์ƒํ•˜๋Š” ์—๋Ÿฌ.VARCHAR(*)์—์„œ ๊ด„ํ˜ธ ์•ˆ์˜ byte๋ณด๋‹ค ์› ๋ฐ์ดํ„ฐ์— ์„ค์ •๋œ byte๊ฐ€ ํด ๋•Œ ๋ฐœ์ƒํ•˜๊ธฐ ๋•Œ๋ฌธ์—, ๊ด„ํ˜ธ ์•ˆ์˜ ์ˆซ์ž๋ฅผ ํ‚ค์›Œ์ฃผ๋ฉด ์‰ฝ๊ฒŒ ํ•ด๊ฒฐ๋œ๋‹ค.  → ์ฃผ์š” ์‹๋ฌผ์€ ์›๋ž˜ VARCHAR(256)์œผ๋กœ ์„ค์ •๋˜์–ด์žˆ์—ˆ๋Š”๋ฐ, ์—‘์…€๋กœ ํ™•์ธํ•ด๋ณด๋‹ˆ '์ฃผ์š” ์‹๋ฌผ'์นผ๋Ÿผ์˜ ๊ธธ์ด๊ฐ€ ๊ฐ€์žฅ ๊ธด ๊ฒƒ์€ 440 ๊นŒ์ง€ ๋˜์–ด์„œ ๊ทธ์˜ ์ตœ๊ณ  880byte์˜€๋‹ค.! ๊ทธ๋ž˜์„œ ๋ƒ…๋‹ค VARCHAR(1024)๋กœ ๋Š˜๋ ค์คฌ๋”๋‹ˆ ๋ง๊ผผํ•˜๊ฒŒ ํ•ด๊ฒฐ๋˜์—ˆ์Œ! Error [1264][22001]: ..
ny:D
'๐Ÿ“’ Today I Learn/๐Ÿ‘พ Error' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก