본문 바로가기

Python

Python [논리 연산자 and, or, not]

def age_check(age):

  print(f"you are {age}")

  if age < 18:

    print("you cant drink")

  elif age == 18 or age == 19:

    print("you are new to this")

  elif age > 20 and age < 25:

    print("you are still young")

  elif not age < 50:

    print("you have to check your condition")

  else:

    print("enjoy your drink")

 

age_check(23)

 

 

 

 

https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not

 

 

'Python' 카테고리의 다른 글

Python [import]  (0) 2019.11.24
Python [for in]  (0) 2019.11.24
Python if - elif - else  (0) 2019.11.24
Python [format] 스트링 안에 변수 값 넣고 출력  (0) 2019.11.24
Python [function] arg 위치 지정 호출  (0) 2019.11.24