티스토리 뷰

[Python]

[python] 변수 선언

코딩-noob 2021. 7. 20. 13:27

아래 파이썬 공부는 replit.com 에서 실행하였습니다.

 

a = 2                             # 숫자

b = 3

c = 'gozip'                    # 문자열은 ' ' 또는 " " 를 넣어준다.

d = True                      # True or False 참 거짓은 첫글자를 대문자로 써줘야 한다. (boolean)

e = 3.14                        # 소수점  float

f = None                      # 파이썬에만 있는 타입이고 js에 null 과 유사하다.

 

print(a,b)                    # 2 3  공백이 있는 2와 3이 나온다

 

print(ab)                     #   ab 는 undefined

 

print(a + b)                  #   5

 

print( type( e ) )          #  보이는 값 <class 'float'>

 

print( type( a ) )          #  보이는 값 <class 'int'>

 

print( type( c ) )          #  보이는 값 <class 'str'>

 

print( type( d ) )          #  보이는 값 <class 'bool'>

 

print( type( f ) )          #  보이는 값 <class 'NoneType'>

 

print( type( 23 ) )          #  보이는 값 <class 'int'>

728x90

'[Python]' 카테고리의 다른 글

[python] python의 형변환  (0) 2021.07.28
[python] input() 함수로 놀아보기  (0) 2021.07.28
[python] 파이썬의 특징  (0) 2021.07.28
[python] python_snake_case  (0) 2021.05.19
[python] 자바스크립트와 다른점  (0) 2021.05.19
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함