MapleStory Finger Point

โ˜… 571

ํ‘๋ฐฑ ์‚ฌ์ง„ ๋งŒ๋“ค๊ธฐ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

#raw ํŒŒ์ผ , 256x256 ํ‘๋ฐฑ์ด๋ฏธ์ง€ 0~255 # 0์— ๊ฐ€๊นŒ์šฐ๋ฉด ๊ฒ€์ • / 255์— ๊ฐ€๊นŒ์šฐ๋ฉด ํฐ์ƒ‰ from tkinter import * def loadImage(fname) : global inImage, XSIZE,YSIZE fp = open(fname, 'rb') for i in range (0,XSIZE): tmpList = [] for k in range(0, YSIZE) : data=int(ord(fp.read(1))) tmpList.append(data) inImage.append(tmpList) fp.close() def displayImage(image) : global XSIZE,YSIZE rgbString = "" for i in range(0,XSIZE): tmpString =..

ํŒŒ์ผ ์•”ํ˜ธํ™”/์•”ํ˜ธํ•ด๋… - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

#์•”ํ˜ธํ™” ํ•˜๋Š” ๋ฐฉ๋ฒ• #ord() ๊ธ€์ž์˜๊ณ ์œ ์ˆซ์ž์•Œ๋ ค์คŒ , chr() ์ˆซ์ž์—๋งž๋Š”๊ธ€์ž์•Œ๋ ค์คŒ inFp, outFp = None, None inStr, outStr = "", "" i=0 secu=0 secuYN = input("1.์•”ํ˜ธํ™” 2. ์•”ํ˜ธ ํ•ด์„ ์ค‘ ์„ ํƒ >> ") inFname = input("์ž…๋ ฅ ํŒŒ์ผ๋ช…์„ ์ž…๋ ฅํ•˜์„ธ์š” :") outFname = input("์ถœ๋ ฅ ํŒŒ์ผ๋ช…์„ ์ž…๋ ฅํ•˜์„ธ์š” :") #1๋ฒˆ ์„ ํƒ์‹œ ์•”ํ˜ธํ™”, 2๋ฒˆ ์„ ํƒ์‹œ ๋ณตํ˜ธํ™” if secuYN == "1" : secu = 100 elif secuYN == "2" : secu = -100 inFp = open(inFname, 'r', encoding = 'utf-8') outFp = open(outFname, 'w', encoding = 'utf-8..

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

· ํ‘œ์ค€ ์ž…๋ ฅ ํ‚ค๋ณด๋“œ์—์„œ ์ž…๋ ฅ๋˜๋Š” ๊ฒƒ · ํ‘œ์ค€ ์ถœ๋ ฅ ํ™”๋ฉด์— ์ถœ๋ ฅ๋˜๋Š” ๊ฒƒ · ์ฝ˜์†” Console ํ‚ค๋ณด๋“œ + ํ™”๋ฉด · ํ™”๋ฉด ์ž…์ถœ๋ ฅ imput() / print() · ํŒŒ์ผ ์ž…์ถœ๋ ฅ read() / write() readline() / writelines() readlines() · ํŒŒ์ผ ์ž…์ถœ๋ ฅ ๊ธฐ๋ณธ๊ณผ์ • ํŒŒ์ผ ์—ด๊ธฐ > ์ฝ๊ธฐ/์“ฐ๊ธฐ > ํŒŒ์ผ ๋‹ซ๊ธฐ · ํŒŒ์ผ ์—ด๊ธฐ ---- open() ๋ณ€์ˆ˜๋ช… = open("ํŒŒ์ผ๋ช…","r") ##์ฝ๊ธฐ## ๋ณ€์ˆ˜๋ช… = open("ํŒŒ์ผ๋ช…","w") ##์“ฐ๊ธฐ## r,w , r+, a, t, b ๋“ฑ ๋งˆ์ง€๋ง‰ ๋งค๊ฐœ๋ณ€์ˆ˜ Mode ๋ชจ๋“œ๋Š” ๋‹ค์–‘ํ•จ · ํŒŒ์ผ ์ฒ˜๋ฆฌ ---- · ํŒŒ์ผ ๋‹ซ๊ธฐ ---- close() ๋ณ€์ˆ˜๋ช….close() · ํ…์ŠคํŠธ ํŒŒ์ผ ์ž…๋ ฅ · --- read() ๋ฌด์กฐ๊ฑด ํŒŒ์ผ ์ฒ˜์Œ -๋ ์ฝ์–ด๋“ค์ธ๋‹ค..

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

1. ๋งž๋Š” ๊ฒƒ์„ ๊ณ ๋ฅด์‹œ์˜ค. 1๋ฒˆ, 2๋ฒˆ, 3๋ฒˆ 4๋ฒˆ => ํ•จ์ˆ˜๋Š” ์—ฌ๋Ÿฌ๋ฒˆ ํ˜ธ์ถœํ•ด์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ํšจ์œจ์ ์ด๋‹ค. 2. ๋นˆ์นธ์„ ์ฑ„์šฐ์‹œ์˜ค def , return def sum (v1,v2): result =0; result = v1,v2 return result 3. 2๋ฒˆ ํ•จ์ˆ˜ ํ˜ธ์ถœ ๋ฐฉ๋ฒ•์œผ๋กœ ์˜ฌ๋ฐ”๋ฅธ ๊ฒƒ์€? 4๋ฒˆ hap = sum(10,20) 4. ํ•จ์ˆ˜ ๋ฐ˜ํ™˜๊ฐ’๊ณผ ๊ด€๋ จ๋œ ๋‚ด์šฉ ์ค‘ ํ‹€๋ฆฐ ๊ฒƒ์€? 4๋ฒˆ ๋ฐ˜ํ™˜๊ฐ’์ด ์—†๋‹ค๋ฉด return ๋ฌธ์€ ์“ฐ์ง€ ์•Š์•„๋„ ๋œ๋‹ค. 5. ๋งค๊ฐœ๋ณ€์ˆ˜ ์ˆซ์ž ์ƒ๊ด€์—†์ด ๋ชจ๋“  ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ๊ณฑํ•˜๋Š” ํ•จ์ˆ˜ , ๋นˆ์นธ์„ ์ฑ„์šฐ์‹œ์˜ค def multiply *var: result = 1 for num in var result = result *num return result 6. ์ถœ๋ ฅ๋˜๋Š” ๊ฐ’์„ ์ฐจ๋ก€๋Œ€๋กœ ์ ์œผ์‹œ์˜ค a = 222..

๋กœ๋˜ ๋ฒˆํ˜ธ ์ถ”์ฒจ ํ”„๋กœ๊ทธ๋žจ - ํŒŒ์ด์ฌ for Beginner (2ํŒ) // self study 9-2

๋žœ๋คํ•จ์ˆ˜๊ฐ’์„ ๋งŒ๋“ค์–ด์ฃผ๋Š” getNumber ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ ๋‹ค. ๋กœ๋˜ ๋ฒˆํ˜ธ num , ๋„ฃ์„ lotto ๋ฆฌ์ŠคํŠธ ์ดˆ๊ธฐํ™”, ๋ฌดํ•œ๋ฃจํ”„๋กœ ๋žœ๋ค ์ˆซ์ž๋ฅผ ์ƒ์„ฑํ•ด์ค€๋‹ค. ์กฐ๊ฑด๋ฌธ : ๋ฆฌ์ŠคํŠธ์— num์ˆซ์ž๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธ ! => ์—†์œผ๋ฉด num ๊ฐ’์„ ์ถ”๊ฐ€ํ•œ๋‹ค. ์กฐ๊ฑด๋ฌธ : ๋ฆฌ์ŠคํŠธ ๊ธธ์ด๊ฐ€ 6๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™์œผ๋ฉด ๋ฉˆ์ถ˜๋‹ค ๋กœ๋˜๋ฒˆํ˜ธ๋ฅผ ๋ณด๊ธฐ ์ข‹๊ฒŒ ์ •๋ ฌํ•ด์ฃผ๊ณ  6์ž๋ฆฌ๋ฅผ ์ถœ๋ ฅํ•ด์ฃผ๋ฉด ๋. import random def getNumber(): return random.randrange(1,46) lotto = [] num = 0 print("๋กœ๋˜ ์ถ”์ฒจ์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค!!\n") while True: num = getNumber() if lotto.count(num) == 0: lotto.append(num) if len(lotto) >= 6 : break ..

(๊ฐœ๋…) ํ•จ์ˆ˜์™€ ๋ชจ๋“ˆ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

· ํ•จ์ˆ˜ --- ํ•จ์ˆ˜๋ช…() ๋งค๊ฐœ๋ณ€์ˆ˜ (Parameter) ์ž…๋ ฅ ๋ฐ›๊ณ , ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ๊ฐ€๊ณต-์ฒ˜๋ฆฌํ•ด์„œ ๋ฐ˜ํ™˜๊ฐ’์„ ๋Œ๋ ค์ค€๋‹ค. ํ•จ์ˆ˜ ํ˜ธ์ถœ -> ํ•จ์ˆ˜ ์‹คํ–‰ -> ๊ฒฐ๊ณผ ๋ฐ˜ํ™˜ -> ๋ฐ˜ํ™˜๊ฐ’ ๋Œ€์ž… def plus(v1,v2): result = 0 result = v1 + v2 return result hap = 0 hap = plus(100,200) print("100๊ณผ 200์˜ plus() ํ•จ์ˆ˜ ๊ฒฐ๊ณผ๋Š” %d" % hap) · ์ง€์—ญ Local ๋ณ€์ˆ˜ , ์ „์—ญ Global ๋ณ€์ˆ˜ ์ง€์—ญ๋ณ€์ˆ˜๋Š” ํ•จ์ˆ˜ ๋‚ด์—์„œ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅ ์ „์—ญ ๋ณ€์ˆ˜๋Š” ๋‹ค์–‘ํ•œ ํ•จ์ˆ˜์—์„œ ์ ‘๊ทผ ๊ฐ€๋Šฅ (์„ ์–ธ ์œ„์น˜๋Š” ์œ„, ์•„๋ž˜ ์ƒ๊ด€์—†์Œ) · ์šฐ์„ ์ˆœ์œ„ : ์ง€์—ญ๋ณ€์ˆ˜ > ์ „์—ญ๋ณ€์ˆ˜ · global ์˜ˆ์•ฝ์–ด ํ•จ์ˆ˜ ์•ˆ์—์„œ ์‚ฌ์šฉ๋˜๋Š” ๋ณ€์ˆ˜๋ฅผ ์ „์—ญ๋ณ€์ˆ˜๋กœ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ์„ ๋•Œ glovbal ์˜ˆ์•ฝ์–ด๋ฅผ ํ†ต..

๋ฌธ์ž์—ด ๋ฌธ์ž์˜ ๋ฐœ์ƒ ๋นˆ๋„ ์„ธ๊ธฐ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

๋”•์…”๋„ˆ๋ฆฌ = ๋นˆ๋„์ˆ˜ ๊ธฐ๋ก ๋ฆฌ์ŠคํŠธ = ์ •๋ ฌํ•  ํŠœํ”Œ๋ฆฌ์ŠคํŠธ ์ฒ˜์Œ์€ for ๋ฌธ์„ ํ†ตํ•ด์„œ ์›๋ฌธ์„ ๋ฌธ์ž ํ•˜๋‚˜์”ฉ ์ฝ์–ด์™€์„œ ๋”•์…”๋„ˆ๋ฆฌ ๊ฐ’์— ๋ˆ„์ ์‹œ์ผœ์ค€๋‹ค. ch ๊ธ€์”จ๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋ฌธ์žฅ => ch in countDic =>True False ๋”•์…”๋„ˆ๋ฆฌ๋ฅผ ์ •๋ ฌํ•ด์ค€๋‹ค . ํŠœํ”Œ -> ๋ฆฌ์ŠคํŠธ๋กœ ๋ณ€ํ™˜ ๋ฆฌ์ŠคํŠธ [a][b] a ์—๋Š” ๋ฌธ์ž b ๋Š” ๋นˆ๋„ ์ˆ˜ ๊ฐ€ ์ €์žฅ๋˜์–ด์žˆ์œผ๋ฏ€๋กœ ์ถœ๋ ฅ. import operator inStr = '''๋‚ด๊ฐ€ ๋‚ด๊ฐ€.. ๋‚ด๊ฐ€ ๊ทธ ์ด๋ฆ„์„ ๋ถˆ๋ €์„๋•Œ ๋‚ด๊ฐ€ ๊ทธ ๋ญ์ง€ .. ์ด๋ฆ„์„ ๋ถˆ๋ €๋‚˜ ๋‚ด๊ฐ€ ๊ทธ ์ด๋ฆ„์„ ์žŠ๊ณ ์žˆ์—ˆ๋‚˜ ๋‚ด๊ฐ€ ์ด๋ฆ„์„ ๋ถˆ๋ €๋‹ค๊ฐ€ ๋ง์•˜๋‹ค๊ฐ€ ์ด๋ฆ„์„...''' countDic = {} countList = [] if __name__ == "__main__": for ch in inStr : if 'ใ„ฑ'

๋Œ€์†Œ๋ฌธ์ž ์ƒํ˜ธ ๋ณ€ํ™˜ํ•˜๊ธฐ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

swapcase() ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ๋ณ€ํ™˜ํ•˜๋Š” ์ฝ”๋“œ๋‹ค. lower ๊ณผ upper ์€ ๋ฌธ์ž ํ•˜๋‚˜์”ฉ ์ถ”์ถœํ•ด์„œ ๋ณ€ํ™˜ํ•ด์•ผํ•œ๋‹ค. ์กฐ๊ฑด๋ฌธ์„ ํ†ตํ•ด ๋Œ€๋ฌธ์ž๋ฉด lower ์†Œ๋ฌธ์ž๋ฉด upper ๊ฐ€ ์‹คํ–‰๋˜๋„๋ก ํ•œ๋‹ค. ๋Œ€์†Œ๋ฌธ์ž๋„ ์•„๋‹ˆ๋ฉด ๊ทธ๋Œ€๋กœ ์ถœ๋ ฅ. inStr, outStr = "", "" ch = "" count, i = 0,0 if __name__ == "__main__" : inStr = input("๋ฌธ์ž์—ด ์ž…๋ ฅ =>") count = len(inStr) for i in range (0,count) : ch = inStr[i] if (ord(ch)>=ord("A") and ord(ch) =ord("a") and ord(ch)

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

1) ์ถœ๋ ฅ ๋‚ด์šฉ ์˜ˆ์ธก ss = "python" ss[0] (0 ์ถœ๋ ฅ) p ss[1:2] (1๋ถ€ํ„ฐ 1๊นŒ์ง€) y ss[-3:-1] (๋’ค์—์„œ 3๋ฒˆ์งธ~ 2๋ฒˆ์งธ ) ho ss[3:] (3 ๋ถ€ํ„ฐ ๋๊นŒ์ง€) hon 2) ์˜ค๋ฅ˜ ๋ฐœ์ƒํ•˜๋Š” ๊ฒƒ ๊ณ ๋ฅด์‹œ์˜ค ss1 = 'Python' ss2 = 'Good' 2๋ฒˆ 4๋ฒˆ ๋ฌธ์ž์—ด๋ผ๋ฆฌ - , / ์—ฐ์‚ฐ์€ ๋ถˆ๊ฐ€๋Šฅํ•˜๋‹ค. 3) ๋นˆ์นธ์ฑ„์šฐ๊ธฐ :: ๋ฌธ์ž์—ด ์ค‘๊ฐ„๋งˆ๋‹ค $ ๋„ฃ๊ธฐ ss = 'Python' for i in range(0,len(ss)) : print(ss[i]+"$",end='') 4) ๋นˆ์นธ์ฑ„์šฐ๊ธฐ :: ๋ฌธ์ž์—ด ๋ฐ˜๋Œ€ ์ˆœ์„œ๋กœ ์ถœ๋ ฅ inStr, outStr = "Python", "" strLen = len(inStr) for i in range(0,strLen): outStr += inStr[0-..