Write an interactive program to help you count all of the boxes in a room. The program
Question:
Write an interactive program to help you count all of the boxes in a room. The program should begin by asking something like How many unnumbered boxes can you see? Then the program will have you number those boxes from 1 to m, where m is your answer. But remember that each box might have smaller boxes inside, so once the program knows you can see m boxes, it should ask you to open box number 1 and take out any boxes you find, numbering those boxes 1.1, 1.2, and so on. It will also ask you to open box number 2 and take out any boxes you find there, numbering those boxes 2.1, 2.2, and so on. This continues for box 3, 4, and so on, up to m. And, of course, each time you number a box 1.1 or 3.8 or something similar, that box might have more boxes inside. Boxes that reside inside of 3.8 would be numbered 3.8.1, 3.8.2, and so on. At the end, the program should print a single number telling you the total number of boxes in the room.
Step by Step Answer:
def boxcounter asks how many unnumbered boxes there are numbox...View the full answer
Students also viewed these Computer science questions
-
Lets think about your computer science class for a moment. You might know several students, perhaps Judy, Jervis, Walter, and Michael. Each of those students knows several other students, and each of...
-
write a job description for Bill Ryan's job. What other information would you need to write a better job description? Remember, this is a job description, not a help wanted ad. Please do your own...
-
Answer the following questions: 1. Build the management-research question hierarchy for Starbuck project 2. the Duetto Card team turned to Green field Online to recruit a panel for one of its online...
-
Julie is the insured on a $300,000 ordinary life insurance policy. Julie sells her life insurance policy to Ben for $20,000. Ben promptly named himself beneficiary. The policy had a cash surrender...
-
Report on Business magazine conducts a survey by mailing a questionnaire to 5000 people known to invest in securities. On the basis of the results, the magazine editors conclude that most investors...
-
Demandforproductxdecreasefrom60unitsto40units whenpriceofproductydecreaseto10takafrom12taka.Findtheelasticityofdemandandcommentontheresult...
-
147.3 2007 154.6
-
1. How would you explain the Guinness pricing strategy and the underlying assumptions about consumer behaviour when Diageo reports for 2005 that in the UK and Ireland the Guinness sales volume fell...
-
Given the following information. Can you please create a: Schedule of Cash Receipts and Schedule of Cash Payments for Direct Materials Thanks :) The management of Zigby Manufacturing prepared the...
-
A Carnot cycle uses 1.00 mol of a monatomic perfect gas as the working substance from an initial state of 10.0 atm and 600 K. It expands isothermally to a pressure of 1.00 atm (Step 1), and then...
-
Tic-Tac-Twice is a game invented by Pat Baggett and Andrzej Ehrenfeucht. It is distributed by the Aristoplay company. The rules simple, starting with two 4x4 boards that each have a pattern of 16...
-
A connected graph is a graph that has a path from every node to every other node. For this project, you are given a connected, undirected, weighted graph in which every edge has a non-negative number...
-
Bridget applied for a TV news commentators job. She has adequate experience to satisfy the job description but was denied the job. Bridget has a substantial birthmark that covers one side of her...
-
Juanita Poblamo makes large ceramic pots for use in outdoor landscape. She currently has two models, one square and the other round. Because of the size of Juanitas creations, only one pot can be...
-
EPI educational products are currently sold without any supplemental materials. The company is considering the inclusion of instructional materials such as an overhead slide presentation, potential...
-
EPI is considering eliminating a product from its ToddleTown Tours collection. This collection is aimed at children one to three years of age and includes tours of a hypothetical town. Two products,...
-
Suppose we estimate the model y i = + u i , where u i N [ 0 , i 2 ] . (a) Show that the OLS estimator of simplifies to ^ = y . (b) Hence directly obtain the variance of y . Show that this...
-
This question presumes access to software that allows NLS and ML estimation. Consider the gamma regression model of Exercise 5-2. An appropriate gamma variate can be generated using \(y=-\lambda \ln...
-
Compute each of the following. 270.00 - (1+ 0.035)-* 0.035
-
Define the term utility software and give two examples.
-
Give an implementation of the size( ) method for the SingularlyLinkedList class, assuming that we did not maintain size as an instance variable.
-
Give an implementation of the size( ) method for the CircularlyLinkedList class, assuming that we did not maintain size as an instance variable.
-
Give an implementation of the size( ) method for the DoublyLinkedList class, assuming that we did not maintain size as an instance variable.
-
3. The nominal interest rate compounded monthly when your $7,000 becomes $11,700 in eight years is ________
-
An investor can design a risky portfolio based on two stocks, A and B. Stock A has an expected return of 21% and a standard deviation of return of 39%. Stock B has an expected return of 14% and a...
-
Advanced Small Business Certifica Drag and Drop the highlighted items into the correct boxes depending on whether they increase or decrease Alex's stock basis. Note your answers- you'll need them for...
Study smarter with the SolutionInn App