Start New Discussion within our Software Development Community

As you know the inventor of the game chess was quite a clever fellow. As the story goes the inventor
presented the game to the king and the king was quite pleased. The king asked what the inventor
wanted as paym
ent. He asked for a grain of cereal for the first square and to have each of the next 63
squares double the previous square. As the story goes the king agrees, but was not to pleased by the
final payment. Create a program that computes how much grain the
king had to pay. Express your
answer in pounds, assume there are 7000 grains to a poundAs you know the inventor of the game chess was quite a clever fellow. As the story goes the inventor
presented the game to the king and the king was quite pleased. The king asked what the inventor
wanted as paym
ent. He asked for a grain of cereal for the first square and to have each of the next 63
squares double the previous square. As the story goes the king agrees, but was not to pleased by the
final payment. Create a program that computes how much grain the
king had to pay. Express your
answer in pounds, assume there are 7000 grains to a pound.please with this...

Hint ...

grains_sum = 0
grains = 1
for square in range(1, 64+1):
    print(square, grains)  # test    
    grains *= 2
    grains_sum += grains

print(grains_sum)  # test
This question has already been answered. Start a new discussion instead.