human
Write a python function to find the smallest power of 2 greater than or equal to n. Here is a solution in Python: ... Can you provide a Python code to find the smallest power of 2 greater than or equal to n?
assistant
#Here is Python code to find the smallest power of 2 greater than or equal to n.
 def next_power_of_2(n): 
  if n and not n & (n - 1):
    return n

  count = 0
  while n != 0: 
    n >>= 1
    count += 1

  return 1 << count;