<jupyter_start><jupyter_text>Boolean Operators<jupyter_code>x = 10
y = 9

#Returns boolean value of either True or False
print(x>y)
print(x==y)
#bool() function allows to evaluate any value, and return True or False
#Almost any value is returned as True if it has some sort of context

print(bool("<NAME>"))
print(bool(25))

#None,empty, 0, and [] returns as False
print(bool(None))
print(bool())
print(bool(0))
print(bool([]))<jupyter_output>True
True
False
False
False
False<jupyter_text>Defining Function<jupyter_code>#Functions can return a boolean: "def myFunction():"

def myFunction():
  return True

print(myFunction())
def myFunction():
  return False

if myFunction(): #Will return the value based on the declaration of myFunction
  print("YES!")
else:
  print("NO!")<jupyter_output>NO!<jupyter_text>Application 1<jupyter_code>print(10>9)

a=6
b=7
print(a==b)
print(a!=a)<jupyter_output>True
False
False<jupyter_text>Arithmetic Operations<jupyter_code>#Python Operators are used to perform operations on variables and values
#// - floor division ; ** - power

#recent values from PREVIOUS cell can be used
print(a+b)
print(a-b)
print(a*b)
print(a**b)<jupyter_output>13
-1
42
279936<jupyter_text>Bitwise Operators<jupyter_code>#Python Bitwise Operators works on bit-by-bit operations
c=60
d=13

print(c & d)
print(c | d)
print(c ^ d)
print(c << 1) #Shifts the binary sequence to the left
print(c << 2)
print(c >> 1) #Shifts the binary sequence to the right<jupyter_output>12
61
49
120
240
30<jupyter_text>Assignment *Operators*<jupyter_code># c+=3 is the same as c = c+3

c+=3
c%=3

print(c)<jupyter_output>0<jupyter_text>Logical Operators<jupyter_code>c = True
d = True

print(c and d)
not(c and d)<jupyter_output>True<jupyter_text>Identity<jupyter_code>print(c is d)
c is not d<jupyter_output><empty_output><jupyter_text>Application 2<jupyter_code>e = 10
f = 5

#Implement the operations + , // , and bit shift right >>

print(e + f)
print(e // f)
print(e>>2) #1010 >> 0101 >> 0010
print(f>>2) #0101 >> 0010 >> 0001<jupyter_output>15
2
2
1
{'fraction_non_alphanumeric': 0.12829268292682927, 'fraction_numerical': 0.041463414634146344, 'mean_word_length': 6.273049645390071, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '509983', 'license': 'Apache-2.0', 'n_tokens_mistral': 856, 'n_tokens_neox': 796, 'n_words': 218, 'path': 'Operations_and_Expressions_in_Python.ipynb', 'repo_name': 'Leyliiii/Elective-1-3', 'size': '2054'}