Due: November 8, 2019
Points: 100
To turn in: Please call your program bpanalyze.py, and submit it and your CSV file to Canvas.
Here is sample output:
The string? heLlo↵ heLlo is not abcdearian The string? aLmost↵ aLmost is abcdearian The string? w3i\$l0l!ow↵ w3i\$l0l!ow is not abcdearian The string? e3f\$f0o!rt↵ e3f\$f0o!rt is abcdearian The string? cOmpuTer↵ cOmpuTer is not abcdearian The string? ABcDE↵ ABcDE is abcdearian The string? control-D
To turn in: Please call your program abcde.py, and submit it to Canvas.
For a given number n, let k be the least number of iterations needed to reach the number 1 (excluding the initial value). Then k is called the total stopping time of n.
For example, if n = 29, then the sequence is:
29 88 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1and so the total stopping time of 29 is 18.
Write a program that takes as input a positive integer and prints both the sequence and the total stopping time for that integer. The output should look like:
29 88 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 The total stopping time for 29 is 18
To turn in: Please call your program collatz.py and submit it to Canvas
|
ECS 36A, Programming and Problem Solving Version of October 29, 2019 at 2:09PM
|
You can also obtain a PDF version of this. |