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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.