MapleStory Finger Point

๐Ÿ’Ž Python/Python_Code 29

๋ฌธ์ž์—ด ์ค‘๊ฐ„์˜ ๊ณต๋ฐฑ ์‚ญ์ œ ํ•˜๊ธฐ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

inStr = " ํ•œ๊ธ€ python ํ”„๋กœ๊ทธ๋ž˜๋ฐ ~ " outStr ="" for i in range(0,len(inStr)) : if inStr[i] != ' ': outStr += inStr[i] print("์›๋ž˜ ๋ฌธ์ž์—ด ==> " + '[' + inStr + ']' ) print("๊ณต๋ฐฑ ์‚ญ์ œ ๋ฌธ์ž์—ด ==> " + '[' + outStr + ']' )

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

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

๋‘ ๊ฐ€์ง€ ๊ธฐ๋Šฅ์˜ ๊ณ„์‚ฐ๊ธฐ - ํŒŒ์ด์ฌ 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