Question: USING PYTHON CODE PLEASE We are making n stone piles! The first pile has n stones. If n is even, then all succeeding piles will
USING PYTHON CODE PLEASE
We are making n stone piles! The first pile has n stones. If n is even, then all succeeding piles will have an even number of stones. If n is odd, all succeeding piles will have an odd number of stones. Each pile must be more stones than the previous pile but as few as possible. Write a Python function to find and display the number of stones in each pile. The function should accept 1 argument that represents the initial number of stones in pile 1 and the number of piles to be generated.
Example Input 1
| Enter number of piles: 8 |
Example Output 1
| Number of stones in each pile: Pile 1 - 8 Pile 2 - 10 Pile 3 - 12 Pile 4 - 14 Pile 5 - 16 Pile 6 - 18 Pile 7 - 20 Pile 8 - 22 |
Example Input 2
| Enter number of piles: 7 |
Example Output 2
| Number of stones in each pile: Pile 1 - 7 Pile 2 - 9 Pile 3 - 11 Pile 4 - 13 Pile 5 - 15 Pile 6 - 17 Pile 7 - 19 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
