allinonecode666
allinonecode666

Reputation: 1

What Is The Output Of This Code, I Didn't Got Any Outputn Because My Computer Is Very Slow

from decimal import Decimal

a = Decimal()
a = 2

for i in range(1, 64):
    a = a*a
print(a)

Upvotes: 0

Views: 62

Answers (1)

shapiro yaacov
shapiro yaacov

Reputation: 2346

Well, looking at the question in the image, what you're actually looking to do is sum the values, not just get the largest one.

Since:

2^0 + 2^1 + ... + 2^n = 1 + 2 + ... + 2^n = 2^(n+1) - 1

all the code you really need is:

print(pow(a,64) - 1)

Upvotes: 1

Related Questions