input: Write a function to generate the powers of two up to a given number.
  assert powersOfTwo(0) == [1]
  assert powersOfTwo(3) == [1, 2, 4, 8]
  assert powersOfTwo(5) == [1, 2, 4, 8, 16, 32]
  assert powersOfTwo(8) == [1, 2, 4, 8, 16, 32, 64, 128, 256]
output: def powersOfTwo(n):
      return [2**i for i in range(n + 1)]