💻
Albert's Til
GitHub
  • 매일매일 조금씩 성장하기
    • README
    • CS
      • Network
      • HTTP
        • NO-CACHE
      • 오류 코드
      • ORM 도구
      • Design Pattern
        • CQRS Pattern
          • Event Sourcing and CQRS pattern
        • Builder Pattern
    • DB
      • MySQL
        • Timeline
        • Pagination
        • Index
        • Database Performance Optimization Strategies
        • B+ tree
        • MySQL Connectors VS MySQL Shell(Scripting) VS MySQL Workbench
        • MySQL Storage Engine Architecture
      • Normalization & Denormalization
      • JPA
        • @Transactional
        • Why JPA?
        • About JPA
        • N+1 Issue
        • Index
        • ElementCollection&CollectionTable
        • orphanRemoval
        • CascadeType
        • Use Subselect
        • Dynamic Instance Creation
        • Paging
        • Order
        • Spefication
        • mappedBy
      • MongoDB
        • ObjectId
      • Why MySQL?
      • ACID properties of transactions
      • Between JPA and JDBC
      • Identifiers in Hibernate/JPA
    • Java
      • Jackson de/serialize
      • Collections.singletonList() vs List.of()
      • Manage dependencies in Gradle
      • Logging Level
      • Bean Validation
      • JVM Internals
        • Threads
          • Frame
        • Shared Between Threads
          • Classloader
            • Class Loader Hierarchy
            • Loading Linking Initialization
      • Java Collection Framework
      • Annotation
      • Generic
      • 디미터 법칙
    • Spring
      • Caching
      • Spring Integration Overview
        • ThreadPollTaskExecutor
        • Messaging Bridge
        • Channel Adapter
        • Poller
        • Configuration and @EnableIntegration
        • Message Endpoints
        • Message Channels
      • HATEOAS
      • @Autowired vs Constructor Dependency Injection
      • Spring Security
        • JWT 토큰 사용한 인가
        • OAuth 2 Login
        • OAuth 2 인증
        • 인가
        • 인증
        • PasswordEncoder
      • IoC Container
      • Filter,Interceptor,AOP,Argument Resolver
      • Spring Annotation
      • About Spring
    • Kafka
      • Error Channel
    • Infra
      • Scale Up || Scale Out
      • Docker
        • Dockerfile
        • Docker Hub Deploy
        • Command
      • Cloud 유형
        • Infrastructure as a Service
        • Platform as a Service
        • Software as a Service
      • 무중단 배포
        • 엔진엑스(Nginx)
      • 코드 자동 배포
        • Technical
      • AWS EC2
        • PEM(Privacy Enhanced Mail) 키
      • AWS RDS
      • AWS S3
    • CodeSquad
      • Spring Boot Project 1주차 회고
      • Spring Boot Project 2주차 회고
      • Spirng Boot Project 3주차 회고
      • Spring Boot Project 4주차 회고
    • Foody Moody 프로젝트
      • Query Performance Comparison
      • HeartCount Asynchronous Issue
      • DeferredResult
      • ResponseBodyEmitter
      • SseEmitter (Spring)
      • Server-Sent Events (SSE)
      • 기술 스택 적용 이유
      • NO-CACHE(HTTP)
      • Transactional
    • DDD
      • AggregateId
    • Test
      • RestAssured
    • Coding and Algorithmic Problems
      • 819. Most Common Word
      • 344. Reverse String
      • 125. Valid Palindrome
      • 937. Reorder Data in Log Files
    • Node
      • Async... Await...
      • Custom Transactional Decorator Challenger
    • Python
      • Python Basic Grammar
        • Comments and Input/Output
        • Variable
        • Data type
        • Operations and syntax
        • List,Tuple,Dictionary,Set
        • Function
        • Conditional statement
        • Loop
    • HTML
      • HTML Basic
      • HTML Basic Tags
      • HTML Form Tags
      • HTML Table Tags
    • CSS
      • CSS Basic
      • CSS Practice
Powered by GitBook
On this page
  • 연사자란?
  • 종류
  • 산술 연산자
  • 비교 연산자
  • 논리 연산자
  • 할당 연산자
  • 식별 연산자
  • 멤버 연산자
  • 참조

Was this helpful?

  1. 매일매일 조금씩 성장하기
  2. Python
  3. Python Basic Grammar

Operations and syntax

연산과 구문

연사자란?

프로그래밍에서 데이터를 처리하고 분석하는 데 쓰이는 기호나 키워드

종류

산술 연산자

  • + : 덧셈

  • - : 뺄셈

  • * : 곱셈

  • / : 나눗셈 (값: float 타입)

  • // : 나눗셈 (값: int 타입)

  • % : 나머지 연산

  • ** : 제곱 연산

전/후위 연산자 지원하지 않음

비교 연산자

  • == : 같음

  • != : 같지 않음

  • < : 작음

  • <= : 작거나 같음

  • > : 큼

  • >= : 크거나 같음

컴퓨터는 소수를 이진수로 변환하여 저장하는데, 이 과정에서 정확한 값이 아닌 근사치로 저장됩니다. 따라서, 부동소숫점 수를 직접 비교하면 예상치 못한 결과가 나올 수 있습니다.

해결 방법:

  • math.isclose() 함수 사용

논리 연산자

  • and

  • or

  • not

할당 연산자

연산자
설명
예시
동등한 연산

=

단순 할당

x = 5

x = 5

+=

덧셈 후 할당

x += 3

x = x + 3

-=

뺄셈 후 할당

x -= 2

x = x - 2

*=

곱셈 후 할당

x *= 4

x = x * 4

/=

나눗셈 후 할당 (실수 나눗셈)

x /= 2

x = x / 2

//=

나눗셈 후 할당 (정수 나눗셈)

x //= 2

x = x // 2

%=

나머지 연산 후 할당

x %= 3

x = x % 3

**=

거듭제곱 후 할당

x **= 2

x = x ** 2

식별 연산자

식별 연산자는 두 변수의 동일한 객체를 참조하고 있는지 확인하는데 사용

연산자
설명
예시
결과

is

두 객체가 동일한 객체인지 비교

a is b

True 또는 False

is not

두 객체가 동일한 객체가 아닌지 비교

a is not c

True 또는 False

is vs ==

  • is 연산자가 id 를 기준으로 주소가 같은지 확인

  • == 비교 연산자는 값이 같은지 확인

멤버 연산자

연산자
설명
예시
결과

in

값이 시퀀스 또는 컬렉션에 존재하는지 확인

3 in [1, 2, 3]

True

not in

값이 시퀀스 또는 컬렉션에 존재하지 않는지 확인

4 not in [1, 2, 3]

True

참조

ChatGPT

Last updated 12 months ago

Was this helpful?

견고한 파이썬