MapleStory Finger Point

๐Ÿ’Ž Python 60

(๊ฐœ๋…) ๋ฌธ์ž์—ด - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

· ๋ฌธ์ž์—ด "", '' ๋กœ ๋ฌถ์–ด ํ‘œํ˜„๋œ ๊ฒƒ => ์ถœ๋ ฅํ•˜๋ฉด '' ์ž‘์€ ๋”ฐ์˜ดํ‘œ๋กœ ์ถœ๋ ฅ๋จ. · ๋ฆฌ์ŠคํŠธ์™€ ๋ฌธ์ž์—ด์€ ๋น„์Šทํ•˜๋‹ค aa=[1,2,3] a[0] a[1:3] a[3:] ss="ํŒŒ์ด์ฌ์ตœ๊ณ " ss[0] ss[1:3] ss[3:] · ๋ฌธ์ž์—ด ์—ฐ๊ฒฐ --- + , * ss="Hello" + "World" ss="Hello"*3 · ๋ฌธ์ž์—ด ๊ธธ์ด --- len () len(ss) · ๋ฌธ์ž์—ด ํ•จ์ˆ˜ --- upper() : ์†Œ๋ฌธ์ž๋ฅผ ๋Œ€๋ฌธ์ž๋กœ --- lower() : ๋Œ€๋ฌธ์ž๋ฅผ ์†Œ๋ฌธ์ž๋กœ --- swapcase() : ๋Œ€,์†Œ๋ฌธ์ž ์ƒํ˜ธ ๋ณ€ํ™˜ --- title() : ๊ฐ ๋‹จ์–ด์˜ ์•ž๊ธ€์ž๋งŒ ๋Œ€๋ฌธ์ž๋กœ ๋ณ€ํ™˜ --- count() : ์ฐพ์„ ๋ฌธ์ž์—ด์ด ๋ช‡๊ฐœ์ธ์ง€ ๊ฐœ์ˆ˜ --- find() : ์™ผ์ชฝ 0๋ฒˆ๋ถ€ํ„ฐ ๋ช‡๋ฒˆ์งธ ์œ„์น˜ํ•œ์ง€ ์ฐพ์Œ (๋ฌธ์ž์—ด์—†์œผ๋ฉด -..

๊ธฐ์ฐจ ์ˆ˜์†ก๋Ÿ‰์— ๋”ฐ๋ผ ์ˆœ์œ„ ๋งค๊ธฐ๊ธฐ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

์—ฌ๋Ÿฌ ๊ธฐ์ฐจ๋ณ„ ์ˆ˜์†ก๋Ÿ‰์— ๋”ฐ๋ฅธ ์ˆœ์œ„ ์ถœ๋ ฅ์„ ํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ ํŠœํ”Œ๋ฆฌ์ŠคํŠธ๋ฅผ ๋งŒ๋“ค์–ด์„œ ๊ธฐ์ฐจ์ด๋ฆ„, ์ˆ˜์†ก๋Ÿ‰(ํ†ค) ์„ ์ž…๋ ฅํ•ด์ค€๋‹ค. trainTupleList ๋ฅผ ๋”•์…”๋„ˆ๋ฆฌ๋กœ ๋ณ€ํ™˜ํ•ด์ค€๋‹ค. tName ๊ฐ’์—๋Š” tmpTup [0] ๋ฒˆ์งธ ๊ฐ’ = ์ง€ํšจ tWeight ๊ฐ’์—๋Š” tmpTup [1] ๋ฒˆ์งธ ๊ฐ’ = 5 ์กฐ๊ฑด๋ฌธ = trainDic์— tName ์ด ์žˆ๋Š”์ง€ ํ™•์ธ ์žˆ์œผ๋ฉด + ๋ˆ„์  ์—†์œผ๋ฉด + ๋Œ€์ž… (.... ๋ฐ˜๋ณตํ•ด์ค€๋‹ค) ------------------- ๊ทธ๋‹ค์Œ์€ ๋”•์…”๋„ˆ๋ฆฌ ์ •๋ ฌ ์ฝ”๋“œ๋‹ค ํ‚ค๋กœ ์ •๋ ฌํ•œ ํ›„ ๋”•์…”๋„ˆ๋ฆฌ ์ถ”์ถœ ๊ฒฐ๊ณผ๋Š” ํŠœํ”Œ๋กœ ๋ณ€๊ฒฝ -> ๋ฆฌ์ŠคํŠธ๋กœ ๋ฐ˜ํ™˜๋จ itemgetter(1)์€ ์˜ ์•„์ดํ…œ์ธ ํŠœํ”Œ์˜ 2๋ฒˆ์งธ ์š”์†Œ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ •๋ ฌํ•˜๊ฒ ๋‹ค๋Š” ์˜๋ฏธ์ด๋‹ค. TrainList ๋Š” ์ˆซ์ž ๊ธฐ์ค€์œผ๋กœ ์ •๋ ฌ์ด ๋œ๋‹ค. ------------------- ๊ทธ ..

ch 7 ์—ฐ์Šต๋ฌธ์ œ ํ’€์ด - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

1) ์˜ค๋ฅ˜๋‚˜๋Š” ๋ถ€๋ถ„์„ ๊ณ ๋ฅด์‹œ์˜ค print(aa[3]) ๋ถ€๋ถ„์ด ์˜ค๋ฅ˜๋‚œ๋‹ค. aa = [10,20,30] ์œผ๋กœ ์ธ๋ฑ์Šค๊ฐ‘ 2๊นŒ์ง€๋งŒ ์ถœ๋ ฅ ๊ฐ€๋Šฅํ•˜๊ณ  3์€ ์—†๋Š” ๊ฐ’์ด๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. 2) ๋ฆฌ์ŠคํŠธ 100๊ฐœ ๋งŒ๋“ค๊ณ  ๊ธธ์ด๋ฅผ ๊ตฌํ•˜๋Š” ์ฝ”๋“œ (๋นˆ์นธ์ฑ„์šฐ๊ธฐ) myList = [] for i in range (0, 100) : myList.append(0) len(myList) 0๋ถ€ํ„ฐ 99๊นŒ์ง€ = 100๋ฒˆ append (0) ์œผ๋กœ ๋ชจ๋“  ๊ฐ’์ด 0์ธ ๋ฆฌ์ŠคํŠธ 100๊ฐœ๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. len ๊ฐ’์€ 100์ด ๋จ 3) ์ฝ”๋“œ ์™„์„ฑํ•˜์‹œ์˜ค myList = [] for i in range(0,3) : myList.append(0) hap = 0 for i in range(0,3) : myList[i] = int(input(str(i+1)+"๋ฒˆ์งธ์ˆซ์ž:")) ..

(๊ฐœ๋…) ๋ฆฌ์ŠคํŠธ, ํŠœํ”Œ, ๋”•์…”๋„ˆ๋ฆฌ- ํŒŒ์ด์ฌ for Beginner (2ํŒ)

ํ•œ ๋ˆˆ์— ๋ณด๊ธฐ ํŽธํ•˜๊ฒŒ ์ •๋ฆฌํ•ด๋ณด์•˜๋‹ค! ์ƒ์„ธํ•œ ๋‚ด์šฉ์€ ์ œ์™ธํ•ด์„œ ์•„๋ž˜ ๋ณธ๋ฌธ์„ ์ฝ์–ด๋ณด๋Š” ๊ฒƒ์„ ์ถ”์ฒœํ•œ๋‹ค. · ๋ฆฌ์ŠคํŠธ ๋ฆฌ์ŠคํŠธ์— ๋‹ค์–‘ํ•œ ๋ฐ์ดํ„ฐํ˜•์„ ์„ž์–ด ๋„ฃ์„ ์ˆ˜ ์žˆ๋‹ค. cc = [] aa = [1,2,3,4] bb= [1,'ํŒŒ์ด์ฌ',3] · ๋ฆฌ์ŠคํŠธ ํ•ญ๋ชฉ ์ถ”๊ฐ€ aa.append(0) ๋ฆฌ์ŠคํŠธ๋ช….append(๊ฐ’) · ๋ฆฌ์ŠคํŠธ ๊ฐœ์ˆ˜ len(๋ฆฌ์ŠคํŠธ) len(aa) · str() :: ์ˆซ์ž -> ๋ฌธ์ž ๋ณ€ํ™˜ ํ•จ์ˆ˜ · ๋ฆฌ์ŠคํŠธ ๊ฐ’ ์ ‘๊ทผ aa[1] ๋ฆฌ์ŠคํŠธ๋ช… [์ฒจ์ž] · ๋ฆฌ์ŠคํŠธ ๊ฐ’ ์ ‘๊ทผ (์Œ์ˆ˜๊ฐ’) aa = [1,2,3,4] aa[-1] -1 -2 -3 -4 ๋งจ ๋’ค๋ถ€ํ„ฐ ์ ‘๊ทผ ๊ฐ€๋Šฅ => 4321 · ๋ฆฌ์ŠคํŠธ ๊ฐ’ (์ฝœ๋ก ์œผ๋กœ ์ง€์ • ์ ‘๊ทผ) ๋ฆฌ์ŠคํŠธ๋ช…[์‹œ์ž‘๊ฐ’:๋๊ฐ’+1] aa[0:3] ##0~2๊นŒ์ง€## aa[2:4] ##2-3๊นŒ์ง€## aa[2:] ##2..

ch 5 ์—ฐ์Šต๋ฌธ์ œ ํ’€์ด - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

1) ๋นˆ์นธ์„ ์ฑ„์šฐ์‹œ์˜ค 1. ์‹œ์ž‘๊ฐ’ 2. ๋๊ฐ’ + 1 3. ์ฆ๊ฐ๊ฐ’ 2) ๋ช‡๋ฒˆ ์ถœ๋ ฅ๋˜๋Š”๊ฐ€? for i in range(1,100,1) : print("~~") 1๋ถ€ํ„ฐ 99๋ฒˆ๊นŒ์ง€ ํ•œ๋ฒˆ์”ฉ ์ถœ๋ ฅ๋˜๋‹ˆ, ์ด 99๋ฒˆ ์ถœ๋ ฅ๋œ๋‹ค. 3) 100๋ถ€ํ„ฐ 200๊นŒ์ง€ 2์˜ ๋ฐฐ์ˆ˜๋งŒ ๋”ํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ ? for i in range(100,201,2) => 2์”ฉ ์ฆ๊ฐํ•˜์—ฌ 2์˜๋ฐฐ์ˆ˜๋งŒ 100๋ถ€ํ„ฐ 200๊นŒ์ง€ ๋”ํ•˜๋Š” for ๋ฌธ 4) ๋ช‡๋ฒˆ ์ถœ๋ ฅ๋˜๋Š”๊ฐ€? i๊ฐ€ 1์ผ๋•Œ k ๊ฐ€ 9๋ฒˆ ์ถœ๋ ฅ๋œ๋‹ค. i ๋Š” 1~9๊นŒ์ง€์ด๋ฏ€๋กœ 9x9 ๋กœ 81๋ฒˆ ์ถœ๋ ฅ๋œ๋‹ค. 5) ๊ตฌ๊ตฌ๋‹จ ๋‹จ์„ ์ž…๋ ฅํ•˜๋ฉด ๊ฑฐ๊พธ๋กœ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ i,sum = 0, 0 dan = 0 dan = int(input("๋‹จ์„ ์ž…๋ ฅํ•˜์„ธ์š” : ")) for i in range(9, 0, -1): sum = dan *..

ch 6 ์—ฐ์Šต๋ฌธ์ œ ํ’€์ด - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

1) ๋ณด๊ธฐ ์ฑ„์šฐ๊ธฐ 1. ์กฐ๊ฑด์‹ 2. ์‹คํ–‰๋ฌธ 1 3. ์‹คํ–‰๋ฌธ 2 2) if ๋ฌธ ๊ฒฐ๊ณผ ์˜ˆ์ธก a = 100 if a != 100: print("100 x") else : print("100 o") 100 o ์ด ์ถœ๋ ฅ๋œ๋‹ค. 3) if ๋ฌธ ๊ฒฐ๊ณผ ์˜ˆ์ธก a = 123 if a == 100 : print ("100 o ") print ("100 x") a ๋Š” 100๊ณผ ๊ฐ™์ง€ ์•Š์Œ์œผ๋กœ ๋‘˜๋‹ค ์ถœ๋ ฅ๋˜์ง€ ์•Š์Œ. 4) 3์˜ ๋ฐฐ์ˆ˜์ธ์ง€ ํŒ๋‹จ ํ”„๋กœ๊ทธ๋žจ ์กฐ๊ฑด๋ฌธ์— a % 3 == 0 ์„ ๋„ฃ์–ด์ฃผ๋ฉด ๋œ๋‹ค. 5) if ๋ฌธ ๊ฒฐ๊ณผ ์˜ˆ์ธก a = 123 if a > 100: if a > 200 : print("์™„์ „ํฐ์ˆ˜์ž…๋‹ˆ๋‹ค.") else : print("์ ๋‹นํ•œ์ˆ˜์ž…๋‹ˆ๋‹ค") else : print("์™„์ „์ž‘์€์ˆ˜์ž…๋‹ˆ๋‹ค") print("ํ”„๋กœ๊ทธ๋žจ ๋์ž…๋‹ˆ๋‹ค.")..

๋‘ ๊ฐ€์ง€ ๊ธฐ๋Šฅ์˜ ๊ณ„์‚ฐ๊ธฐ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

โœ… 1๋ฒˆ ์ž…๋ ฅ์ˆ˜์‹ ๊ณ„์‚ฐ / 2๋ฒˆ ๋‘์ˆ˜ ์‚ฌ์ด์˜ ํ•ฉ๊ณ„ select, answer, numStr, num1, num2 =0,0,"",0,0 select = int(input("1.์ž…๋ ฅํ•œ์ˆ˜์‹ ๊ณ„์‚ฐ , 2. ๋‘์ˆ˜ ์‚ฌ์ด์˜ ํ•ฉ๊ณ„ : ")) if select == 1: numStr = input(' ** ์ˆ˜์‹์„ ์ž…๋ ฅํ•˜์„ธ์š” : ') answer = eval(numStr) print("%s ๊ฒฐ๊ณผ๋Š” %5.1f์ž…๋‹ˆ๋‹ค." % (numStr,answer)) elif select == 2: num1 = int( input(' ** ์ฒซ๋ฒˆ์งธ ์ˆซ์ž ์ž…๋ ฅ : ')) num2 = int( input(' ** ๋‘๋ฒˆ์งธ ์ˆซ์ž ์ž…๋ ฅ : ')) for i in range (num1, num2+1, 1) : answer += i print("%d+~..

๋งˆ๋ฆ„๋ชจ ๋ณ„๋ชจ์–‘ ์ฐ๊ธฐ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

โœ… ๋ณ„์œผ๋กœ ๋งˆ๋ฆ„๋ชจ ์ฐ๊ธฐ while ๋ฌธ์„ ํ†ตํ•ด ๋งˆ๋ฆ„๋ชจ ๋ชจ์–‘์„ ๋งŒ๋“ค์–ด์ค„๊ฑฐ๋‹ค. ๋จผ์ € i k ๊ฐ’์„ ํ†ตํ•ด 2์ค‘ while ์„ ์‚ฌ์šฉํ•ด์ค€๋‹ค. ๋งˆ๋ฆ„๋ชจ์˜ ์ตœ๋Œ€ ๊ธธ์ด๋ฅผ 9๋กœ ์žก์œผ๋ฉด 1357 9 7531 ๋ณ„์€ ์ด๋Ÿฐ์‹์˜ ๋ชจ์–‘์ด ์žกํ˜€์•ผํ•œ๋‹ค. ์–‘์˜† ๋นˆ์นธ๋„ ๊ณ„์‚ฐ์„ ํ•ด์ค˜์•ผํ•œ๋‹ค. 4 3 4 3 3 3 2 4 2 1 7 1 0 9 0 ์ด๋Ÿฐ ๊ทœ์น™์ด ์ƒ๊ธด๋‹ค. ๊ฐ๊ฐ ์–‘์˜†์— 43210 ์œผ๋กœ ์ค„์–ด๋“œ๋Š” ๊ทœ์น™์„ ๋ฐ˜๋ณต๋ฌธ์œผ๋กœ ๋งŒ๋“ค์–ด์ค€๋‹ค. i ๊ฐ€ 0์ผ๋•Œ k