정수 여러 개 입력
a,b = map(int,input().split())
소수점 아래 특정 자릿수까지 출력
a,b = map(float,input().split())
print(format(a/b,".3f")
비트시프트
- 왼쪽 비트시프트(<<): 오른쪽에 0이 주어진 개수만큼 추가
- 오른쪽 비트시프트(>>): 왼쪽에 0(0 또는 양의 정수인 경우)이나 1(음의 정수인 경우)이 개수만큼 추가되고, 가장 오른쪽에 있는 1비트는 사라짐.
- ex) 10의 2진수 표현은 1010
10 << 1 = 10100 (10진수) = 20
10 >> 1 = 101 = 5
bool
bool(0)
bool(1)
- boolean 값을 다루는 예약어에는 not, and(&), or(|) 가 있음.
3항 연산
- x if C else y : 조건 C를 만족하면 x, 아니면 y
a,b = map(int,input().split())
c = a if(a>=b) else b
print(c)
비트 단위 논리연산
- ~(bitwise not), &(bitwise and), |(bitwise or), ^(bitwise xor),
<<(bitwise left shift), >>(bitwise right shift)
- -n = ~n + 1
a = 142
print(~a+1)