파이썬[Python]: keyword - or 키워드

내장함수 - or 키워드(keyword)


/// 설명

하나 이상의 값이 참일 경우 참(True)을 반환합니다.(모든 값이 False 일 경우 False)

※ 형식
or

reference
https://docs.python.org/3/reference/expressions.html#or

/// 예제

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
= False
= False
 
= a or b
 
print(x)  # False
 
if x:
    print('x is True')
else:
    print('x is False')  # x is False
 
= True
 
= a or b or c
 
print(y)  # True
 
print('y is True' if y else 'y is False')  # y is True
# test = 'y is True' if y else 'y is False'
# print(test)
 
cs

* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)


– 당신을 응원합니다. –

댓글

이 블로그의 인기 게시물

파이썬[Python]: 내장함수 - from_bytes 메서드

파이썬[Python]: 내장함수 - __len__ 메서드

파이썬[Python]: kivy - 한글 사용

파이썬[Python]: 내장함수 - bit_length 메서드

C 언어: sin 함수, cos 함수, tan 함수