목록bool (1)
IT 세계의 후아
[python]bool 자료형/함수, 논리연산자
※ boolean bool 자료형 True, False ※ bool 함수 bool(값이 있는 변수) == True int(bool(True))) == 1 # 백준 2753 a = int(input()) if a % 4 == 0: if a % 100 == 0: if a % 400 == 0: print(1) else: print(0) else: print(1) else: print(0) # bool a = int(input()) print(int((not a % 4) and (a % 100 or not a % 400))) # 프로그래머스 n의 배수 def solution(num, n): return 1 if num % n == 0 else 0 # 다른 풀이 # return int(num % n == 0) #..
Coding/Python
2024. 3. 14. 16:09