ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [Python] 변수, 연산자
    Python/[이론] 2022. 4. 11. 22:51

     

    #print(): 콜솔에 출력
    print('hello python')
    
    #변수 선언없이 바로 사용 가능
    #파이썬의 변수는 타입이 고정이 아님. 언제든지 바뀔수 있음.
    a=1
    b=2.34
    c='asdf'
    d="qwer"
    e=True  #False
    
    #type()연산자. 타입확인 연산자
    print('a type:', type(a), ', a:', a)  #변수 이름은 값
    print('b type:', type(b), ', b:', b)
    print('c type:', type(c), ', c:', c)
    print('d type:', type(d), ', d:', d)
    print('e type:', type(e), ', e:', e)
    

     

     

     

     

     

    산술 연산자
    +
    -
    *
    **: 제곱(x**3: x의 3승)
    /: 나눗셈
    //: 정수 나눗셈(소수점 버림)
    %

    비교 연산자
    >
    >=
    <
    <=
    ==
    !=

    관계연산자
    and
    or
    not

    대입 연산자
    =
    +=
    *=
    **=
    /=
    //=
    %=

     

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

    [Python] tuple  (0) 2022.04.11
    [Python] set  (0) 2022.04.11
    [Python] 리스트  (0) 2022.04.11
    [Python] 제어문  (0) 2022.04.11
    [Python] request.args.get()  (0) 2022.04.07
Designed by Tistory.