-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
GPT를 활용하여 if문에 대해 추가적으로 공부를 하다보니, "삼항 연산자"라는게 있다고 하더라고요.
예를 들어:
a = 4
if a > 0:
print("a는 양수")
else:
print("a는 양수 아님")을 한줄로
a = 4
print("a는 양수") if a > 0 else print("a는 양수 아님")이렇게 쓸 수 있다고 하더라고요.
삼항 연산자라는게 조건문이랑 뭐가 다른건지 잘 모르겠어서 GPT에게 물어봐도 이해가 잘 되지 않아 질문을 올립니다.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels