def chess_rice(): rice = 1 squares = 1 for squares in range(1, 64): #For each square on the board rice *= 2 #Double the number of rice squares += 1 #Add one to the number of squares used rice_tons = rice / 32000000 #32000000 is the number of grains of rice in a ton rice_truck = rice_tons / 50 #50 is the number of tons of rice a truck could hold rice_year = rice / 19000 / 365 / 4 #19000 grains of rice have the caloric sustenance for one adult for one day. I then did the math for a year with a family of 4 adults. print rice_year chess_rice()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question