MapleStory Finger Point

๐Ÿ’Ž Python/Python_Code 29

N์˜ ๋ฐฐ์ˆ˜ ๊ฑด๋„ˆ๋›ฐ๊ณ  ์ถœ๋ ฅ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

3์œผ๋กœ ๋‚˜๋ˆด์„๋•Œ ๋‚˜๋จธ์ง€๊ฐ€ 0์ธ ์ˆซ์ž๋Š” 3์˜ ๋ฐฐ์ˆ˜๊ฐ€ ๋œ๋‹ค. ์ฆ‰ for ๋ฌธ ์•ˆ์— ์กฐ๊ฑด๋ฌธ์„ ๋„ฃ์–ด Continue ๋ฅผ ๋„ฃ์–ด์ฃผ๋ฉด 3์˜ ๋ฐฐ์ˆ˜์ธ ๊ฒฝ์šฐ ํ•˜๋‹จ sum ์— ๋ˆ„์ ์ด ๋˜์ง€ ์•Š๊ณ  ๊ฑด๋„ˆ๋›ฐ์–ด์ง„๋‹ค. sum , i = 0, 0 for i in range(1,101) : if i % 3 == 0 : continue sum += i print ("1~100ํ•ฉ๊ณ„ (3๋ฐฐ์ˆ˜ ์ œ์™ธ) %d " % sum)

ํ•ฉ๊ณ„ ๋ฐ˜๋ณต ๊ณ„์‚ฐํ•˜๊ธฐ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

โœ… ๋‘ ์ˆซ์ž์˜ ํ•ฉ๊ณ„ ๋ฐ˜๋ณต ๊ณ„์‚ฐ (Ctrl + C ๋ˆ„๋ฅผ๋–„๊นŒ์ง€ ๋ฐ˜๋ณต) sum =0 a,b = 0,0 while (True) : a = int(input("์ฒซ๋ฒˆ์งธ ์ˆซ์ž")) b = int(input("๋‘๋ฒˆ์งธ ์ˆซ์ž")) sum = a+b print ("a+b ํ•ฉ๊ณ„ : %d" % sum); โœ… ๋‘ ์ˆซ์ž์˜ +-*/ (Ctrl + C ๋ˆ„๋ฅผ๋–„๊นŒ์ง€ ๋ฐ˜๋ณต) sum =0 a,b = 0,0 ch="" while (True) : a = int(input("์ฒซ๋ฒˆ์งธ ์ˆซ์ž : ")) b = int(input("๋‘๋ฒˆ์งธ ์ˆซ์ž : ")) ch = input("์—ฐ์‚ฐ์ž ์ž…๋ ฅ : ") if (ch == "+") : print ("a+b : %d" % (a+b)); elif (ch == "-") : print ("a-b : %d" % (a-b)..

๊ตฌ๊ตฌ๋‹จ ํ”„๋กœ๊ทธ๋žจ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

โœ… ๊ตฌ๊ตฌ๋‹จ ํ”„๋กœ๊ทธ๋žจ i,sum = 0, 0 dan = 0 dan = int(input("๋‹จ์„ ์ž…๋ ฅํ•˜์„ธ์š”")) for i in range(1, 10, 1): sum = dan * i print ("๊ตฌ๊ตฌ๋‹จ %d x %d = %d" % (dan,i,sum)) โœ… ๊ตฌ๊ตฌ๋‹จ ํ”„๋กœ๊ทธ๋žจ ๊ฑฐ๊พธ๋กœ ์ถœ๋ ฅ i,sum = 0, 0 dan = 0 dan = int(input("๋‹จ์„ ์ž…๋ ฅํ•˜์„ธ์š”")) for i in range(9, 0, -1): sum = dan * i print ("๊ตฌ๊ตฌ๋‹จ %d x %d = %d" % (dan,i,sum)) โœ… ๊ตฌ๊ตฌ๋‹จ ํ”„๋กœ๊ทธ๋žจ i,k=0,0 for i in range (2,10,1) : for k in range (1,10,1) : print(" %dx %d = %d" %(i,k,i*k) ) โœ… ..

ํ•ฉ๊ณ„ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

โœ… 500 ~ 1000 ์‚ฌ์ด์˜ ํ™€์ˆ˜ ํ•ฉ๊ณ„ ๊ตฌํ•˜๊ธฐ -- for i,sum = 0, 0 for i in range(501, 1001, 2): sum = sum + i print ("500๊ณผ 1000 ์‚ฌ์ด์˜ ํ™€์ˆ˜ ํ•ฉ๊ณ„ %d " % sum) โœ… 0 ~ 100 ์‚ฌ์ด์˜ 7์˜ ๋ฐฐ์ˆ˜ ํ•ฉ๊ณ„ ๊ตฌํ•˜๊ธฐ -- for i,sum = 0, 0 for i in range(0, 101, 7): sum = sum + i print ("7์˜ ๋ฐฐ์ˆ˜ ํ•ฉ๊ณ„ %d " % sum) โœ… ํ‚ค๋ณด๋“œ๋กœ ์ž…๋ ฅํ•œ ๊ฐ’๊นŒ์ง€ ํ•ฉ๊ณ„ ๊ตฌํ•˜๊ธฐ -- for i,sum = 0, 0 num = 0 num = int(input("๊ฐ’์„ ์ž…๋ ฅํ•˜์„ธ์š”")) for i in range(1, num+ 1, 1): sum = sum + i print ("์ˆซ์ž ํ•ฉ๊ณ„ %d " % sum) โœ…..

๋™์ „ ๊ตํ™˜ ํ”„๋กœ๊ทธ๋žจ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

โœ… ๋™์ „ ๊ตํ™˜ ํ”„๋กœ๊ทธ๋žจ ๊ตํ™˜ํ•  ๋ˆ์„ ๋ฐ›์„ money ๋ณ€์ˆ˜๋ฅผ ์„ ์–ธํ•ด์ฃผ๊ณ  ๊ฐ๊ฐ ๊ตํ™˜๋  ๋™์ „์„ ๋‹ด์„ ๋ณ€์ˆ˜๋“ค๋„ ์„ ์–ธํ•ด์ค€๋‹ค. // ์—ฐ์‚ฐ์ž๋ฅผ ํ†ตํ•ด์„œ ์ฐจ๋ก€๋Œ€๋กœ money๋ฅผ 500์œผ๋กœ ๋‚˜๋ˆˆ ๋ชซ๋งŒ C500์— ์ €์žฅํ•˜๊ณ  ๋‚˜๋จธ์ง€ ๊ฐ’์€ ๋‹ค์‹œ money ์— ์ €์žฅํ•œ๋‹ค ๊ทธ ๋‹ค์Œ์€ 100์› 50์› ๋ฐ˜๋ณต ํ›„ ์ถœ๋ ฅํ•ด์ฃผ๋ฉด ๋œ๋‹ค. ## ๋ณ€์ˆ˜ ์„ ์–ธ ## money, c500, c100, c50, c10 = 0,0,0,0,0 ## ๋ฉ”์ธ ์ฝ”๋“œ ## money = int(input("๊ตํ™˜ํ•  ๋ˆ์€ ์–ผ๋งˆ์ž…๋‹ˆ๊นŒ?")) c500 = money // 500 money %= 500 c100 = money // 100 money %= 100 c50 = money // 50 money %= 50 c10 = money // 10 money %= 10 print("..

์ž…๋ ฅ ๋ฌธ์ž์—ด์„ ๊ฑฐ๊พธ๋กœ ์ถœ๋ ฅํ•˜๊ธฐ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

๋ฌธ์ž์—ด์„ ๋จผ์ € ์ž…๋ ฅ ๋ฐ›๋Š”๋‹ค. for๋ฌธ์„ ์‚ฌ์šฉํ•ด์„œ ๊ฑฐ๊พธ๋กœ ์ถœ๋ ฅ์„ ํ•ด์ค„๊ฑด๋ฐ for ๋ณ€์ˆ˜ in range(์‹œ์ž‘๊ฐ’, ๋๊ฐ’, ์ฆ๊ฐ) ๋ฌธ์ž์—ด ๊ธธ์ด -1 (์•ˆ๋…•ํ•˜์‹ญ๋‹ˆ๊นŒ 6๊ฐœ -1 = 5) 5๋ถ€ํ„ฐ ์‹œ์ž‘ํ•ด์„œ -1 ๊นŒ์ง€ -1์”ฉ ๊ฐ์†Œํ•˜๊ธฐ inStr[5] [4] [3] [2] [1] [0] ๊นŒ์ง€ ์‹คํ–‰ end = "" ๋Š” ๊ฐœํ–‰ ๋ฐฉ์ง€ inStr = "" if __name__ == "__main__" : inStr = input("๋ฌธ์ž์—ด ์ž…๋ ฅ -> ") for i in range(len(inStr) -1, -1, -1): print('%c' % inStr[i], end = '' )

์ง„์ˆ˜ ๋ณ€ํ™˜ ํ”„๋กœ๊ทธ๋žจ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

โœ…์ง„์ˆ˜ ๋ณ€ํ™˜ ํ”„๋กœ๊ทธ๋žจ sel = int(input("์ž…๋ ฅ ์ง„์ˆ˜ ๊ฒฐ์ • (16,10,8,2) :")) num = input("๊ฐ’ ์ž…๋ ฅ: ") if sel == 16 : num10 = int(num,16) if sel == 10 : num10 = int(num,10) if sel == 8 : num10 = int(num,8) if sel == 2 : num10 = int(num,2) print("16์ง„์ˆ˜ ==> ", hex(num10)) print("8์ง„์ˆ˜ ==> ", oct(num10)) print("2์ง„์ˆ˜ ==> ", bin(num10)) print("10์ง„์ˆ˜ ==> ", num10) โœ… ์ง„์ˆ˜ ๋ณ€ํ™˜ ํ”„๋กœ๊ทธ๋žจ (์‘์šฉ) : ๊ฐ™์ง€ ์•Š๋‹ค๋Š” != ์‚ฌ์šฉ : ๊ด€๊ณ„์—ฐ์‚ฐ์ž and ์‚ฌ์šฉ sel = int(input("์ž…๋ ฅ ..

ํ„ฐํ‹€ ๊ทธ๋ž˜ํ”ฝ ํ”„๋กœ๊ทธ๋žจ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

โœ… ํ„ฐํ‹€ ๊ทธ๋ž˜ํ”ฝ ํ”„๋กœ๊ทธ๋žจ (๊ธฐ๋ณธ) import turtle ##ํ„ฐํ‹€๊ทธ๋ž˜ํ”ฝ์‚ฌ์šฉ์„์œ„ํ•œ์‚ฝ์ž…## ##ํ•จ์ˆ˜ ์„ ์–ธ## ##๋ณ€์ˆ˜ ์„ ์–ธ## myT=None ##์•„๋ฌด๊ฒƒ๋„์—†๋‹ค๋Š” None ์œผ๋กœ ์ดˆ๊ธฐํ™”## ##๋ฉ”์ธ ์ฝ”๋“œ## myT=turtle.Turtle() ##myT ๋กœ ํ„ฐํ‹€ ๋Œ€์ž…## myT.shape('turtle') ##๊ฑฐ๋ถ์ด ๋ชจ์–‘ 7๊ฐ€์ง€## for i in range(0,4) : myT.forward(200) ##๊ฑฐ๋ถ์ด๋ฅผ ์•ž์œผ๋กœ ์ด๋™## myT.right(90) ##๊ฑฐ๋ถ์ด๋ฅผ ์˜ค๋ฅธ์ชฝ์œผ๋กœ ํšŒ์ „## turtle.done() โœ… ํ„ฐํ‹€ ๊ทธ๋ž˜ํ”ฝ ํ”„๋กœ๊ทธ๋žจ (์‘์šฉ) 1. ์™ผ์ชฝ ๋งˆ์šฐ์Šค : ๊ฑฐ๋ถ์ด๊ฐ€ ์„ ์„ ๊ทธ๋ฆผ 2. ์Šคํฌ๋กค ๋งˆ์šฐ์Šค : ๊ฑฐ๋ถ์ด ํ™•๋Œ€/์ถ•์†Œ (์ƒ‰๋ณ€๊ฒฝ) 3. ์˜ค๋ฅธ์ชฝ ๋งˆ์šฐ์Šค : ๊ฑฐ๋ถ์ด๊ฐ€ ์„  ๊ทธ๋ฆฌ์ง€ ์•Š๊ณ  ์ด๋™๋งŒํ•จ import tur..

๊ฐ„๋‹จ ๊ณ„์‚ฐ๊ธฐ ํ”„๋กœ๊ทธ๋žจ (์‚ฌ์น™์—ฐ์‚ฐ) - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

๊ฐ„๋‹จ ์‚ฌ์น™์—ฐ์‚ฐ ๊ณ„์‚ฐ๊ธฐ ํ”„๋กœ๊ทธ๋žจ a = int(input("A ๊ฐ’์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š” : ")) b = int(input("B ๊ฐ’์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š” : ")) result = a+b print(a,"+",b,"=",result) result = a-b print(a,"-",b,"=",result) result = a*b print(a,"*",b,"=",result) result = a/b print(a,"/",b,"=",result) โœ…input() ํ•จ์ˆ˜๋Š” ๊ฐ’์„ ์ž…๋ ฅ๋ฐ›์„ ๋•Œ ๋ฌธ์ž์—ด๋กœ ์ทจ๊ธ‰ํ•˜์—ฌ ๊ฐ’์„ ๋ฐ›๋Š”๋‹ค. ๋ฌธ์ž์—ด์„ ๋”ํ•˜๋ผ๋Š” ๋ช…๋ น์„ ์ฒ˜๋ฆฌํ•˜์ง€ ๋ชปํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์˜ค๋ฅ˜! a = input() b = input() result = a+b print(a,"+",b,"=",result) โœ… ๋ฌธ์ž์—ด -> ์ •์ˆ˜๋กœ ๋ณ€ํ™˜ํ•ด์ฃผ๋ฉด ๋œ๋‹ค. a..