How many grains of wheat would be on the chessboard

Assignment Help Python Programming
Reference no: EM132354731

Question

There is a famous puzzle intended to demonstrate the surprising growth of exponential sequences, sometimes called the "Wheat and chessboard problem."

If a chessboard were to have wheat placed upon each square such that one grain was placed on the first square, two on the second, four on the third, and so on (doubling the number of grains on each subsequent square), how many grains of wheat would be on the chessboard at the finish?

There are 64 squares on a chess board. The function uses an accumulator loop to calculate the answer to a general version of this problem (i.e., using arbitrary sized chessboards, not just a 64 square board).

Specification: The second function written should be called 'wheatChess'.

The function should take one (1) argument: an integer representing the number of squares on the board.

The function should return one (1) integer containing the total number of wheat grains on the entire board.

Please use an accumulator for loop to receive full credit.

Note: at some point, the numbers will be too large and you will get an error. Do not worry about this. Assume we will pass in board sizes that the implementation of Python can handle.

Reference no: EM132354731

Questions Cloud

Critical issues of this strategic management business case : What's this Strategic Management Business Case about? Which are the three most Critical Issues of this Strategic Management Business Case?
Allow the user to specify the file name on the command-line : Allow the user to specify the file name on the command-line. If the user doesn't specify any file name, then prompt the user for the name.
Write the program that reads from a text file : Write the program that reads from a text file. Read each line and send it to the output file, preceded by line numbers. Whose fleece was white as snow.
Firm is considering the purchase of smaller firm : Your firm is considering the purchase of a smaller firm because it believes that it can manage the assets of that firm more efficiently.
How many grains of wheat would be on the chessboard : There is a famous puzzle intended to demonstrate the surprising growth of exponential sequences, sometimes called the "Wheat and chessboard problem."
Write the function maxval which returns larger of integers : Write the function maxVal ( a , b ) which returns the larger of integers a and b. Write a script which tests maxVal interactively within a print statement.
Discuss leadership-innovation and entrepreneurship practice : Analyze the company's business level and corporate-level strategies Discuss leadership, innovation and entrepreneurship practices.
How do you make a function that prompt the user to enter : How do you make a function that prompt the user to enter two sentences. Then it will print a combined sentence, consisting of alternating words.
Valuation of healthcare performance : What role have public perception and disinterestedness played in the valuation of healthcare performance?

Reviews

Write a Review

Python Programming Questions & Answers

  Write a program that displays 10 random balls in a rectangle

Write a program that displays 10 random balls in a rectangle with width 120 and height 100, centered at (0,0).

  How to read a html file using python

How to read a html file using python, then extract id and links in that file.

  Write a program that finds the longest word in dictionary

The letters A through F are used for writing hexadecimal numbers and can also spell a few English words.

  You need to do the run test page only

configure page will pass me the JSON object - what data is been flagged - What kind of test and object - how to find out bad data if the configure page is not

  Write program that create list large enough to hold all data

Write a program that creates a list large enough to hold all the data, then reads all the data from the file into that list.

  Determine how many students scored above the average

He wants to average the grades for his last exam in his medieval literature course and then determine how many students scored above the average and how many scored below.

  1 one factor that leads to a decline in biodiversity is the

1. one factor that leads to a decline in biodiversity is the introduction of non-native species. however most species

  What prompted the authors to try and address

What is the question that this study is trying to answer and what prompted the authors to try and address this question?

  Write a program that takes a value from a user

Write a program that takes a value from a user and stores it in the registry. You can use any key name that you like but also store the current time as another value inside of your new key

  Without using the system function to call any bash commands

without using the system function to call any bash commands write a python program that will implement a simple version

  Design and implementation of your demonstration system

ICT705 Data and System Integration Assignment Task, University of the Sunshine Coast, Australia. Design and implementation of your demonstration system

  Write python code that will execute a list

Write python code that will execute a list of functions with supplied parameters and report the observed runtime for each function run. Assume that the input file has a list of strings like so:

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd