+ 1
How could I write a code that sum the power of 2 from 2 ^1 to 2^65?
1 Answer
+ 3
result = 0
for i in range(66):
result += 2 ** i
print(result)
we define a variable named result by setting it to 0 at start. the i takes values from 0 to 65, so you have the exponentation and the sum of it. hope it helped!