Develop

Develop/Python

ํŒŒ์ด์ฌ ๊ธฐ์ดˆ ๋ฌธ๋ฒ•(์„ ์ˆ˜์ง€์‹) / ๋ฆฌ์ŠคํŠธ์™€ ๋‚ด์žฅํ•จ์ˆ˜(1)

# ๋ฆฌ์ŠคํŠธ์™€ ๋‚ด์žฅํ•จ์ˆ˜ ๋ฆฌ์ŠคํŠธ : ๋ณ€์ˆ˜๋“ค์„ ์ผ๋ ฌ๋กœ ๋ฐฐ์น˜ํ•œ๊ฒƒ a = [] # ๋นˆ ๋ฆฌ์ŠคํŠธ ์ƒ์„ฑ b = list() # ๋นˆ ๋ฆฌ์ŠคํŠธ ์ƒ์„ฑ a = [1, 2, 3, 4, 5] b = list(range(1,11)) # [1,2,3,4,5,6,7,8,9,10] ๋ฆฌ์ŠคํŠธ ์ƒ์„ฑ ๋ฆฌ์ŠคํŠธ ๋งจ๋์— ๊ฐ’์„ ์ถ”๊ฐ€ํ•˜๊ธฐ a.append(6) ํŠน์ • ์ธ๋ฑ์Šค๊ฐ’์— ๊ฐ’์„ ์ง€์ • a.insert(3, 7) # 3๋ฒˆ ์ธ๋ฑ์Šค์— 7์„ ์‚ฝ์ž… ํŠน์ • ์ธ๋ฑ์Šค ๊ฐ’ ์‚ญ์ œ , ์ธ์ž์—†์ด ์‚ฌ์šฉ์‹œ ๋งจ ๋์ž๋ฆฌ ๊ฐ’ ์‚ญ์ œ a.pop() a.pop(3) # 3๋ฒˆ ์ธ๋ฑ์Šค(= 7) ์‚ญ์ œ ํŠน์ • ๊ฐ’์„ ์ฐพ์•„์„œ ์‚ญ์ œ a.remove(4) # ๋ฆฌ์ŠคํŠธ์— 4 ๊ฐ’์ด ์žˆ์œผ๋ฉด ์‚ญ์ œ a.index(5) # 5 ๋ผ๋Š” ๊ฐ’์ด ๋ช‡๋ฒˆ์งธ ์ธ๋ฑ์Šค์— ์žˆ๋Š๋ƒ a = list(range(1,11)) sum(a) # a..

Develop/Python

ํŒŒ์ด์ฌ ๊ธฐ์ดˆ ๋ฌธ๋ฒ•(์„ ์ˆ˜์ง€์‹) / ๋ฌธ์ž์—ด๊ณผ ๋‚ด์žฅํ•จ์ˆ˜

#๋ฌธ์ž์—ด๊ณผ ๋‚ด์žฅํ•จ์ˆ˜ msg = “It is Time” # ๋ฌธ์ž์—ด msg.find(“h”) # ํ•ด๋‹นํ•˜๋Š” ๋ฌธ์ž์˜ ์ธ๋ฑ์Šค ๋ฐ˜ํ™˜ msg.count(“h”) # ๋ฌธ์ž๊ฐ€ ๋ช‡๊ฐœ ์žˆ๋‚˜ msg[:2] # 0 ๋ถ€ํ„ฐ 1๋ฒˆ๊นŒ์ง€ ์ถ”์ถœ , ์Šฌ๋ผ์ด์‹ฑ msg[3:5] # 3,4๋ฒˆ ์ถ”์ถœ len(msg) # ๋ฌธ์ž์—ด์˜ ๊ธธ์ด for i in range(len(msg)): print(msg[i], end=“ “) for x in msg: # x ๊ฐ€ ๋ฌธ์ž์—ด msg ์˜ ๋ฌธ์ž ํ•˜๋‚˜ํ•˜๋‚˜ ์ ‘๊ทผ print(x, end=“ ”) print(msg.upper()) # ๋ฌธ์ž์—ด์„ ๋Œ€๋ฌธ์ž๋กœ ์ถœ๋ ฅ ( ์›๋ณธ์€ ๊ทธ๋Œ€๋กœ ์žˆ์Œ ) print(msg.lower()) # ์†Œ๋ฌธ์ž msg.isupper() # ๋Œ€๋ฌธ์ž์ด๋ฉด True msg.islower() # ์†Œ๋ฌธ์ž์ด๋ฉด Fals..

Develop/Python

ํŒŒ์ด์ฌ ๊ธฐ์ดˆ ๋ฌธ๋ฒ•(์„ ์ˆ˜์ง€์‹) / ( ๋ณ€์ˆ˜ , ์กฐ๊ฑด๋ฌธ , ๋ฐ˜๋ณต๋ฌธ )

๋ณ€์ˆ˜ : ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•ด๋†“๋Š” ๊ณต๊ฐ„ a = 1 1 ์ด๋ผ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ a ๋ณ€์ˆ˜์— ์ €์žฅํ•œ๋‹ค # ๊ฐ’ ๊ตํ™˜ a , b = 10 , 20 a , b = b , a # ๋ณ€์ˆ˜ ํƒ€์ž… type(a) #์ถœ๋ ฅ print(a, b, c) print(“ number “ ) print(a , b, c, sep=‘’) # ๋ณ€์ˆ˜ ์ถœ๋ ฅ์‹œ ๊ณต๋ฐฑ๊ฐ„๊ฒฉ์—†์ด ์ถœ๋ ฅ #print ์ถœ๋ ฅ์‹œ ์ค„๋ฐ”๊ฟˆ ๋Œ€์‹  end print(a, end=‘ ‘) print(b, end=‘ ‘) print(c) #๋ณ€์ˆ˜์ž…๋ ฅ๊ณผ ์—ฐ์‚ฐ์ž # ํ‚ค๋ณด๋“œ ์ž…๋ ฅ๋ฐ›๊ธฐ a=input() a,b = input().split() #split() : ์ž…๋ ฅ์‹œ ๊ตฌ๋ถ„์ž๋ฅผ ํ†ตํ•ด ๋ถ„๋ฆฌํ•œ๋‹ค , ๊ณต๋ฐฑ์ด๋‹ˆ๊นŒ ๋„์–ด์“ฐ๊ธฐ๋กœ ๊ตฌ๋ถ„ํ•˜์—ฌ a ๋„ฃ๊ณ  b ๋„ฃ๊ณ  ์ž…๋ ฅ : 2 3 # ํƒ€์ž… ๋ณ€๊ฒฝ a = int(a) b = int(b) ..

hello_u
'Develop' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (4 Page)