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 :: qradiobutton example 
Python :: pandas to latex 
Python :: python decimal string 
Python :: set form field disabled django 
Python :: python date iso 8601 
Python :: pandas column by index 
Python :: orderd set in python 
Python :: tkinter menus 
Python :: The specified file cannot be played on the specified MCI device. The file may be corrupt, not in the correct format, or no file handler available for this format. python 
Python :: sang nguyen to python 
Python :: python pandas replace not working 
Python :: sys.path[0] 
Python :: how to convert days into seconds in python using time.time() 
Python :: df reset index 
Python :: Python Program to count the number of lowercase letters and uppercase letters in a string. 
Python :: python glob all files in directory recursively 
Python :: replace value in dataframe 
Python :: loop through list of tuples python 
Python :: python convert dict to xml 
Python :: pyautogui press enter 
Python :: python file size in bytes 
Python :: cant install tensorflow pip python 3.6 
Python :: what does class meta do in django 
Python :: Read text file line by line using the readline() function 
Python :: dense rank in pandas 
Python :: python tkinter scrollbar widget 
Python :: panda3d 
Python :: flask flash not working 
Python :: read excel into dataframe python 
Python :: count occurrences of a character in a string python 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =