티스토리 뷰

삼항연산자를 사용해서 더 깔끔하게 코딩해봤다. 

 

print('Junhee is '+'not '*(m>0)+'cute!')

누가 이렇게 해놨던데 개쩐다고 생각했다 ㅋㅋㅋㅋ숏코딩오짐

 

N = int(input())
cute = not_cute = 0
for i in range(N):
    if int(input()) == 1:
        cute += 1
    else:
        not_cute += 1
print("Junhee is cute!" if cute > not_cute else "Junhee is not cute!")

 

 

eval 쓴 예도 봤는데 뭔지 잘몰라서 그냥 넘어감 😔(www.acmicpc.net/source/13442756)

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함