3. PIVOTING DIE (5 MARKS) Consider the board below, which can be imagined as being infinite,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
3. PIVOTING DIE (5 MARKS) Consider the board below, which can be imagined as being infinite, so only a small part is represented. A die is placed on cell number 1 of the board in the position indicated: 3 at the top, 2 at the front (towards cell number 4 of the board), and 1 on the right (towards cell number 2 of the board). Recall that 4 is opposite to 3, 5 is opposite to 2, and 6 is opposite to 1. The die can be moved from cell 1 to cell 2, then to cell 3, then to cell 4..., each time pivoting by 90 degrees in the appropriate direction (to the right, forwards, to the left, or backwards). For instance, after it has been moved from cell 1 to cell 2, 2 is still at the front but 6 is at the top and 3 is on the right. 43 44 45 46 47 48 49 42 21 22 23 24 25 26 41 20 7 8 9 10 27 19 6 1 2 11 28 40 39 18 5 4 3 12 29 38 17 16 15 14 13 30 37 36 35 34 33 32 31 Enter the desired goal cell number: A Incorrect value, try again Enter the desired goal cell number: Incorrect value, try again Enter the desired goal cell number: -1 Incorrect value, try again 50 Write a program, stored in a file named pivoting_die.py, that prompts the user for a strictly positive integer N, and outputs the numbers at the top, the front and the right after the die has been moved to cell N. Here is a possible interaction. $python3 pivoting_die.py Enter the desired goal cell number: 0 Incorrect value, try again . Enter the desired goal cell number: 1 On cell 1, 3 is at the top, 2 at the front, and 1 on the right. $ python3 pivoting_die.py 3 Enter the desired goal cell number: 29 On cell 29, 3 is at the top, 2 at the front, and 1 on the right. $python3 pivoting_die.py Enter the desired goal cell number: 2006 On cell 2006, 4 is at the top, 1 at the front, and 2 on the right. 3. PIVOTING DIE (5 MARKS) Consider the board below, which can be imagined as being infinite, so only a small part is represented. A die is placed on cell number 1 of the board in the position indicated: 3 at the top, 2 at the front (towards cell number 4 of the board), and 1 on the right (towards cell number 2 of the board). Recall that 4 is opposite to 3, 5 is opposite to 2, and 6 is opposite to 1. The die can be moved from cell 1 to cell 2, then to cell 3, then to cell 4..., each time pivoting by 90 degrees in the appropriate direction (to the right, forwards, to the left, or backwards). For instance, after it has been moved from cell 1 to cell 2, 2 is still at the front but 6 is at the top and 3 is on the right. 43 44 45 46 47 48 49 42 21 22 23 24 25 26 41 20 7 8 9 10 27 19 6 1 2 11 28 40 39 18 5 4 3 12 29 38 17 16 15 14 13 30 37 36 35 34 33 32 31 Enter the desired goal cell number: A Incorrect value, try again Enter the desired goal cell number: Incorrect value, try again Enter the desired goal cell number: -1 Incorrect value, try again 50 Write a program, stored in a file named pivoting_die.py, that prompts the user for a strictly positive integer N, and outputs the numbers at the top, the front and the right after the die has been moved to cell N. Here is a possible interaction. $python3 pivoting_die.py Enter the desired goal cell number: 0 Incorrect value, try again . Enter the desired goal cell number: 1 On cell 1, 3 is at the top, 2 at the front, and 1 on the right. $ python3 pivoting_die.py 3 Enter the desired goal cell number: 29 On cell 29, 3 is at the top, 2 at the front, and 1 on the right. $python3 pivoting_die.py Enter the desired goal cell number: 2006 On cell 2006, 4 is at the top, 1 at the front, and 2 on the right.
Expert Answer:
Answer rating: 100% (QA)
this task in Python by implementing a function that calculates the positions of the t... View the full answer
Related Book For
Applied Regression Analysis and Other Multivariable Methods
ISBN: 978-1285051086
5th edition
Authors: David G. Kleinbaum, Lawrence L. Kupper, Azhar Nizam, Eli S. Rosenberg
Posted Date:
Students also viewed these programming questions
-
If the focal length of a lens is 3 centimeters and the image distance is 5 centimeters from the lens, what is the distance from the object to the lens?
-
Ayayai Company prepares its statement of cash flows using the direct method for operating activities. For the year ended December 31, 2024, Ayayai Company reports the following: Sales on account...
-
Find the volumes of the solids in Problems 4952 correct to the nearest unit. 4 cm -6 cm 8 cm
-
Two small nonconducting spheres have a total charge of 90.0C. (a) When placed 28.0 cm apart, the force each exerts on the other is 12.0 N and is repulsive. What is the charge on each? (b) What if the...
-
The goal of project portfolio management is to help maximize business value to ensure _______________. A. profit maximization B. enterprise success C. risk minimization D. competitive advantage
-
What documents should you attempt to obtain before a lawsuit is filed during the informal fact-gathering stage? What sources are available to you to locate these documents?
-
Determine the amount of the standard deduction allowed for 2014 in the following independent situations. In each case, assume that the taxpayer is claimed as another person's dependent. a. Curtis,...
-
Given the following statement of comprehensive income data, calculate net income: sales = $135, cost of goods sold = $40, miscellaneous expenses = $35, depreciation = $20, interest expense = $20, tax...
-
For the beam and loading shown, determine the minimum required width b, knowing that for the grade of timber used, all = 12 MPa and Tall = 832 kPa. (Round the final answer to two decimal places.) 2.4...
-
The records for Kalman Ltd . show the following data for calendar 2 0 2 3 : 1 . Gross profit on instalment sales recorded on the books was $ 1 0 0 , 0 0 0 . Gross profit from collections of...
-
At May 3 1 , 2 0 2 2 , the accounts of Blossom Manufacturing Company show the following. May 1 inventories - finished go ds $ 1 5 , 6 2 4 , work in process $ 1 8 , 2 2 8 , and raw materials $ 1 0 , 1...
-
The sales of a company grow from $450 to $730 over 8 years. What is the percentage growth per annum, r?
-
John Reardon purchased 100 shares of Tomco Corporation in December 2019, at a total cost of $1,782. He held the shares for 15 months and then sold them, netting $2,535. During the period he held the...
-
Consider Sam and Jo, two pet owners. Every week, both Sam and Jo spend $24 on cat food. Cat food comes in two types, dry food and wet food. Dry food costs $1 per lb. while wet food costs $2 per lb....
-
What is the ph of balsamic vinegar having an acetic acid content of 7%? Ka= 1.8x10^-5 Refer to the following information and answer the question based on the Ricardo model: U.S. U.K. Wheat...
-
ABC company leased new advanced computer equipment to STU Ltd on 1 January 2019.STULtd has to pay annual rental of $290,000 starting at 1 January 2019. It is a four years lease with ultimate rental...
-
a.-d. Repeat Problem 3, using REACTIM2 as the dependent variable and referring to the accompanying computer output. In problem 3 a. Observe the cross-tabulation of AGEGROUP and PPM_CO in the...
-
The following table gives the average patient waiting time in minutes for patients from a random sample of 16 physicians, classified by type of practice and type of physician a. Classify each factor...
-
A five-year follow-up study was carried out to assess the relationship of diet and weight to the incidence of stomach cancer in 40- to 50-year-old males in a certain metropolitan area. Let K- denote...
-
Chef's Catering completed the following selected transactions during May 2020: Required 1. Show whether each transaction would be handled as a revenue or an expense using both the cash basis and...
-
Consider the unadjusted trial balance of Burrows Landscaping at December 31, 2020, and the related month-end adjustment data: The following adjustments need to be made on December 31 before the...
-
Gonzales Sales and Service completed the following transactions during 2020: Required 1. Journalize these entries by debiting an asset account for Prepaid Rent and by crediting a liability account...
Study smarter with the SolutionInn App