Question: in python, i think we have to classify using list = [] The purpose of this lab is to give you practice with repetition using

in python, i think we have to classify using list = []  in python, i think we have to classify using list =
[] The purpose of this lab is to give you practice with

The purpose of this lab is to give you practice with repetition using while loops, using conditional statements, and handling exceptions. Program Description Consider this rule for transforming a positive integer n : if n is even, divide it by 2 if not, multiply it by 3 and add 1 The Collatz conjecture says that, no matter what integer you start with, applying this transformation over and over will eventually reach the value 1. Write a program that prompts the user for a starting value n, and then applies the above transformation repeatedly until n is 1 . You must use an exception handler to catch all invalid input that are not integers. In addition, you must validate your input to make sure it's a positive number. Once you have valid input, the program should count the number of transformations it took to reach 1 and print that count and the transformations. The program should stop after one positive number is computed for generating its Collatz conjecture and stop. If the input value is invalid, the user must be prompted repeatedly until one valid value is supplied. Comments: For this lab, you must include your name in a comment, and also include comments denoting where input is collected, where exceptions are handled, and where the Collatz calculations are performed. Example Output: Sample output 1: Enter a positive number: 11 11>34>17>5226>13>4020>10>5>16>8>4>21 14 transformations Sample output 2 : Page 1 of 2 Enter a positive number: Please enter an integer value greater than zero

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!