호이호우
Beatlefeed
호이호우
전체 방문자
오늘
어제
  • 분류 전체보기 (75)
    • 세상은 지금... (4)
    • 인공지능 (24)
    • 코딩배우기 (21)
      • HTML, CSS (7)
    • 심리학 (25)

블로그 메뉴

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록

공지사항

인기 글

태그

  • pix2pix
  • LeakyReLU
  • Decoder
  • Loss Function
  • ADHD
  • U-Net Generator
  • CIFAR-10
  • Deep learning
  • 파이썬
  • DCGAN
  • U-Net
  • mnist
  • BatchNormalization
  • 권위주의적육아
  • 행동심리
  • Python
  • Encoder
  • cGAN
  • 발달심리학
  • 인공지능
  • Gan
  • Diana Baumrind
  • Optimizer
  • keras
  • discriminator
  • Sketch2Pokemon
  • Momentum
  • 심리치료
  • tensorflow
  • generator

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
호이호우

Beatlefeed

7일차)프로그래밍 핵심 개념 in Python(boolean, type)
코딩배우기

7일차)프로그래밍 핵심 개념 in Python(boolean, type)

2020. 8. 31. 14:52
반응형

1. Boolean(불린)


print(2 > 1) # True
print(2 < 1) # False
print(3 >= 2) # True
print(3 <= 3) # True
print(2 == 2) # True
print(2 != 2) # False

print("Hello" == "Hello") # True
print("Hello" != "Hello") # False

print(2 > 1 and "Hello" == "Hello") # True

print(not not True) # not True : False
print(not not False) # not False : True

print(7 == 7 or (4 < 3 and 12 > 10)) # True

x = 3

print(x > 4 or not (x < 2 or x == 3)) # False


2. Type 함수


int(type(3)) # <class 'int'>
print(type(3.0)) # <class 'float'>
print(type("3")) # <class 'str'>
print(type(True)) # <class 'bool'>

def hello():
    print("Hello world!")

print(type(hello)) # <class 'function'> 자료형
print(type(print))
# <class 'builtin_function_or_method'>

# builtin Python에 기본적으로 내장되어 있는



3. 활용법


number = 3
print("숫자니?!")
if type(number) == int:
    print("맞네!")
else:
    print("아닌데?!")

result = "5"
print("숫자니?!")
if isinstance(result, int):
    print("그렇네")
else:

    print("아니네~")


반응형
저작자표시

'코딩배우기' 카테고리의 다른 글

파이썬 리스트(list)와 문자열 정리|Python  (0) 2021.01.21
8일차)프로그래밍 핵심 개념 in Python(return, optional parameter)  (0) 2020.09.05
객체 지향 프로그래밍 개념  (0) 2020.08.28
6일차)프로그래밍 핵심 개념 in Python(foramt, 포맷팅)  (0) 2020.08.28
5일차)프로그래밍 핵심 개념 in Python(숫자형, 문자열, 형변환)  (0) 2020.08.26
    '코딩배우기' 카테고리의 다른 글
    • 파이썬 리스트(list)와 문자열 정리|Python
    • 8일차)프로그래밍 핵심 개념 in Python(return, optional parameter)
    • 객체 지향 프로그래밍 개념
    • 6일차)프로그래밍 핵심 개념 in Python(foramt, 포맷팅)
    호이호우
    호이호우
    나의 관심 콘텐츠를 즐겁게 볼 수 있는 Beatlefeed!

    티스토리툴바