[프로그래머스]/python

[프로그래머스] 코딩 기초 > 간단한 논리 연산

0_TLS 2024. 5. 5. 15:16

문제 보기

더보기

<나의 코드>

def solution(x1, x2, x3, x4):
    if x1 == 'false' and x2 == 'false':
        tmp1 = 'false'
    else:
        tmp1 = 'true'
    if x3 == 'false' and x4 == 'false':
        tmp2 = 'false'
    else:
        tmp2 = 'true'
    if tmp1 == 'true' and tmp2 == 'true':
        return True
    return False

 

<정답 코드>

def solution(x1, x2, x3, x4):
    return (x1 or x2) and (x3 or x4)