객체의 주소값이 같으면 True를 반환한다.
==
객체의 값이 같으면 True를 반환한다.
a = 10 b = 10 print("a is b =", a is b) print("a == b =", a == b) print("id(a) =", id(a)) print("id(b) =", id(b))
a is b = True a == b = True id(a) = 4545772160 id(b) = 4545772160
a = 999 b = 999 print("a is b =", a is b) print("a == b =", a == b) print("id(a) =", id(a)) print("id(b) =", id(b))
a is b = False a == b = True id(a) = 140654371171984 id(b) = 140654371172112
10과 999의 문법적 차이는 존재하지 않음에도 주소값이 다른 이유는 파이썬의 Default 값이 Object Interning을 사용하기 때문이다.
참고자료1 참고자료2
x and y
: if x is false, then x, else y>>> print(1 and 9) # 1 is True -> 9 is True -> print 9 9 >>> print(2 and 9) # 2 is True -> 9 is True -> print 9 9 >>> print(1 and 0) # 1 is True -> 0 is False -> print 0 0 >>> print(0 and 1) # 0 is False -> print 0 0 >>> print(0 and 0) # 0 is False -> print 0 0 >>> print(bin(0b1010 and 0b1111)) # 0b1010 is True -> 0b1111 is True -> print 0b1111 0b1111
>>> print(1 & 9) # True & True -> True is 1 1 >>> print(2 & 9) # True & True -> True is 1 1 >>> print(1 & 0) # True & False -> Fales is 0 0 >>> print(0 & 1) # False & True -> Fales is 0 0 >>> print(0 & 0) # False & False -> Fales is 0 0 >>> print(bin(0b1010 & 0b1111)) # Bitwise calculation 0b1010
x or y
: if x is false, then y, else x>>> print(1 or 9) # 1 is True -> 9 is True -> print 1 1 >>> print(2 or 9) # 2 is True -> 9 is True -> print 2 2 >>> print(1 or 0) # 1 is True -> 0 is False -> print 2 1 >>> print(0 or 1) # 0 is False -> 1 is True -> print 1 1 >>> print(0 or 0) # 0 is False -> 0 is False -> print 0 0 >>> print(bin(0b1010 or 0b1111)) # 0b1010 is True -> 0b1111 is True -> print 1010 0b1010
>>> print(1 | 9) # 0b0001 | 0b1001 = 0b1001 9 >>> print(2 | 9) # 0b0010 | 0b1001 = 0b1011 11 >>> print(1 | 0) # 0b0001 | 0b0000 = 0b0001 1 >>> print(0 | 1) # 0b0000 | 0b0001 = 0b0001 1 >>> print(0 | 0) # 0b0000 | 0b0000 = 0b0000 0 >>> print(bin(0b1010 | 0b1111)) # 0b1010 | 0b1111 = 0b1111 0b1111
>>> print(not(0)) # 0 is False True >>> print(not(9)) # 9 is True False
>>> print(~0) # 0b0000의 보수 = 0b1111 = -1 -1 >>> print(~7) # 0b0111의 보수 = 0b1000 = -8 -8
Decimal value 4bits binary 7 0 111 6 0 110 5 0 101 4 0 100 3 0 011 2 0 010 1 0 001 0 0 000 -1 1 111 -2 1 110 -3 1 101 -4 1 100 -5 1 011 -6 1 010 -7 1 001 -8 1 000
https://kumu.io/bothbest
https://kumu.io/bothbest/why-do-people-consider-bamboo-flooring
https://www.aleviforum.com/bothbest
https://worldschoolface.com/index.php/profile-55061
https://amazemediacollege.com/forums/users/bothbest/
https://forum.kiasuparents.com/user/bothbest
https://zeroone.art/profile/bothbest
https://www.photocontest.gr/users/bamboo-flooring/
https://medibulletin.com/author/bothbest/
https://www.classiccitynews.com/profile/bothbest/profile
https://www.happycampersmontessori.com/profile/bothbest/profile
https://www.levelupbasketballtrainingllc.com/profile/bothbest/profile
https://www.housedumonde.com/profile/bothbest/profile
https://www.printables.com/@bothbest_3582539
https://www.do3d.com/profile/bothbest/profile
https://www.cambodgemag.com/en/profile/bothbest/profile
https://www.yapstate.gov.fm/profile/bothbest/profile
https://www.mimigstyle.com/profile/bothbest/profile
https://www.clevercomponents.com/portal/community/p9957/bamboo-flooring.aspx
https://www.salesfully.com/profile/bothbest/profile
https://www.blog.bhsusa.com/profile/chinahousehold65215/profile
https://www.informe21.com/profile/bothbest/profile
https://www.hentai-foundry.com/user/bothbest/blogs/20357/The-Unique-Journey-of-Bamboo-Flooring
https://infiniteabundance.mn.co/members/35641220
https://infiniteabundance.mn.co/posts/90004462
https://infiniteabundance.mn.co/posts/90004531
https://visiontrainstation.mn.co/members/35641262
https://visiontrainstation.mn.co/posts/90004581
https://visiontrainstation.mn.co/posts/mind-blowing-unheard-facts-about-bamboo-floors
https://womenindata.mn.co/members/35641326
https://pathwaycitychurch.mn.co/members/35641360
https://pathwaycitychurch.mn.co/posts/90004764
https://pathwaycitychurch.mn.co/posts/90004776
https://aisalon.mn.co/members/35641436
https://www.palistrong.org/members/35641496
https://authortunities-hub.mn.co/members/35641539
https://authortunities-hub.mn.co/posts/eco-friendly-flooring-why-bamboo-is-a-sustainable-choice
https://authortunities-hub.mn.co/posts/bamboo-flooring-thailand-supplier