MapleStory Finger Point

๐Ÿƒ‍โ™‚๏ธBaekjoon/Python

#5597 ๊ณผ์ œ์•ˆ๋‚ด์‹ ๋ถ„ - python

HYEJU01 2024. 4. 15. 02:55
a=[]
i,j = 0,0

for i in range(28):
   a.append(int(input()))

a.sort()


for j in range(30):
   if (j+1 not in a) == True: 
      print(j+1)

 

์ˆ™์ œ ์ œ์ถœํ•œ 28๋ช… ๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅ๋ฐ›์•„์ฃผ๊ณ , ์˜ค๋ฆ„์ฐจ์ˆœ ์ •๋ ฌํ•ด์ค€๋‹ค.

์ดํ›„ not in ์—ฐ์‚ฐ์ž + for ๋ฌธ์„ ํ†ตํ•ด

๋ฆฌ์ŠคํŠธ์— ์—†๋Š” ๊ฐ’์„ ์‰ฝ๊ฒŒ ์•Œ์•„๋‚ผ ์ˆ˜ ์žˆ๋‹ค. 

True ๊ฐ’์ด ์ถœ๋ ฅ๋˜๋ฉด ๋ฆฌ์ŠคํŠธ์— ์—†๋Š” ๊ฐ’์ด๋ฏ€๋กœ

๊ทธ ๊ฐ’์„ ์ถœ๋ ฅํ•ด์ฃผ๋ฉด ๋!

 

 

 

 

<< ๐Ÿคฎ ๋ง‰ํžŒ ์ด์œ  & ํ•ด๊ฒฐ  >>

not in / in ์—ฐ์‚ฐ์ž ์ถœ๋ ฅ ์•ˆ๋˜๋Š” ์ด์œ 

for j in range(30):
   if (j+1) not in a == True: 
      print(j+1)

์ดˆ๋ฐ˜์— ๊ณ„์† ๊ฐ’ ์ถœ๋ ฅ์ด ์•ˆ๋˜๊ณ  ๋ง‰ํžˆ๋Š” ๊ฒƒ์ด๋‹ค! ๐Ÿ˜จ

๋ถ„๋ช… True ์— ๊ฑธ๋ ค์„œ ๊ฐ’ ๋‘๊ฐœ๊ฐ€ ์ถœ๋ ฅ๋˜์–ด์•ผํ•˜๋Š”๋ฐ .!!!!

์ด์œ ๊ฐ€ ๋ญ”์ง€ ๊ณ„์† ์‹œ๋„ํ•˜๋‹ค ์•Œ์•„๋ƒˆ๋‹ค ๐Ÿ˜Š

 

for j in range(30):
   if (j+1 not in a) == True: 
      print(j+1)

if ๋ถ€๋ถ„์˜ not in ์—ฐ์‚ฐ์ž ์กฐ๊ฑด ๋ถ€๋ถ„์„ ์ „์ฒด ๊ด„ํ˜ธ๋ฅผ ์ณ์ค˜์•ผํ•œ๋‹ค !

๊ด„ํ˜ธ ์ณ์ฃผ๋‹ˆ ๋ฐ”๋กœ ์ถœ๋ ฅ๋จ ๐Ÿ˜‰

 

 

 

 

<< ๐Ÿ”” ์‚ฌ์šฉ๋œ ํ•จ์ˆ˜ >>

๐Ÿ”” ๋ฆฌ์ŠคํŠธ๋ช….append() : ๋ฆฌ์ŠคํŠธ์— ๊ฐ’ ์ถ”๊ฐ€ํ•˜๊ธฐ

๐Ÿ”” ๊ฐ’ in ๋ฆฌ์ŠคํŠธ / ๊ฐ’ not in ๋ฆฌ์ŠคํŠธ : ํŠน์ • ๊ฐ’์ด ๋ฆฌ์ŠคํŠธ์— ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ์—ฐ์‚ฐ์ž