Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

what does ^ do python

# This is a binary XOR
True ^ True # = False, as expected for xor

# For integers it's more complicated.  First we change the integers to
# binary.  Then we take each column one at a time and do xor on them.
8 ^ 3 # = 11.


"""
1000  # 8 (binary)
0011  # 3 (binary)
----  # APPLY XOR to each column
1011  # result = 11 (binary)
"""
Comment

what does % do in python

#  % returns the remainder 
12 % 2 #this will return 0
11 % 2 #this will return 1
Comment

what does % do in python

65 % 2
#This will be 1, since % will calculate the remainder of the variable
# % is the modulus operator
Comment

PREVIOUS NEXT
Code Example
Python :: lambda en python 
Python :: functions python examples 
Python :: django optional path parameter 
Python :: os.move file 
Python :: filter foreign fileds django_filters 
Python :: optimizationed bubble sort optimizationed 
Python :: image blur in python 
Python :: python list to dict 
Python :: data where values in column starts with particular value 
Python :: python ctypes maximize window 
Python :: binary python 
Python :: python list of list to list of string 
Python :: sort by the frequency of occurrences in Python 
Python :: how to count specific element in a list python 
Python :: how to return number in binary python 
Python :: timeout socket python 
Python :: run multiple test cases pytest 
Python :: log log grid python 
Python :: python os.walk recursive 
Python :: creating a bar plot bar | creating a bar chart 
Python :: solidity compiler for python 
Python :: python 2d dictionary 
Python :: pandas datetime to unix timestamp 
Python :: pandas dataframe for loop begin end index 
Python :: python string generator 
Python :: WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. buildozer 
Python :: while loop py 
Python :: python turtle shapes 
Python :: global variable python 
Python :: Error: getaddrinfo ENOTFOUND www.python.org www.python.org:443 Downloading Python failed. Error: { Error: getaddrinfo ENOTFOUND www.python.org www.python.org:443 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =