if-else도 한줄로

이동규 (Justin)·2020년 6월 13일
0
post-thumbnail
# 이것을
if a>7:
	print('yes')
else:
	print('no')
    
# 이렇게 한줄로 줄일 수 있다
print('yes') if a>7 else print('no')

참 쉽죠?

profile
Frontend Developer, JamStack, Ethereum

0개의 댓글