Tuesday, 13 February 2018

Python Logical Not (not or !) and bitwise not(~)

Logical not it return true of false
ex
a = not True
b = not False
o/p : False
       True

Bitwise Not it return the compliment of number(1 to 0 and 0 to 1)

a = True
b = False
print ~a
print ~b
o/p
 -2
-1 

No comments:

Post a Comment

Django rest api - filter

views.py from django_filters.rest_framework import DjangoFilterBackend class PollList(viewsets.ModelViewSet):     queryset = X.objects...