• 회원가입
  • 로그인
  • 구글아이디로 로그인

[keyword] Python - and 키워드 - 모든 조건이 참인지 판별하는 논리연산자. (= and연산자 = 앤드연산자)

1688  
목차
  1. and 예제 - 모두 참이면 True
  2. and 정의
  3. and 예제 - if 조건문

 

and 예제 - 모두 참이면 True

 

x = (5 > 3 and 5 < 7)

print(x)

 

결과값: True

 

and 정의

 

조건을 결합해 모두 참인지 판별하는 논리 연산자.

※ 조건이 모두 참이어야 True. 그 외는 False.

※ 보통, if 조건문, while 반복문 등에서 사용.

 


cf.

or 연산자 : 조건 중 최소 하나라도 참이면 True, 그외는 False.

not 연산자 : 조건 결과의 역 반환. (즉, 참이면 False, 거짓이면 True)

 

 

and 예제 - if 조건문

 

if 5 > 3 and 5 < 7:

  print("두 조건 모두 참.")

else:

  print("적어도 한 조건은 거짓.")

 

결과값: 두 조건 모두 참. 


 


분류 제목
module Python - statistics.mode() 메서드 ★ - 최빈값 반환. (= mode메서드 = 모드)
module Python - statistics.pstdev() 메서드 -
module Python - statistics.stdev() 메서드 -
module Python - statistics.pvariance() 메서드 -
module Python - statistics.variance() 메서드 -
module Python - math 모듈 메서드・상수 종류 (※ 수학 모듈)
module Python - math.acos() 메서드 -
module Python - math.acosh() 메서드 -
module Python - math.asin() 메서드 -
module Python - math.asinh() 메서드 -
module Python - math.atan() 메서드 -
module Python - math.atan2() 메서드 -
module Python - math.atanh() 메서드 -
module Python - math.ceil() 메서드 ★ - 천장 반올림 (= 상위 정수로 반올림. = ceil메서드…
module Python - math.comb() 메서드 -
module Python - math.copysign() 메서드 -
module Python - math.cos() 메서드 -
module Python - math.cosh() 메서드 -
module Python - math.degrees() 메서드 -
module Python - math.dist() 메서드 -
19/24
목록
찾아주셔서 감사합니다. Since 2012