Question: my program so far. I keep getting an error at, if num >=0. i need to use while at the start of the program. please

 my program so far. I keep getting an error at, if
my program so far. I keep getting an error at, if num >=0. i need to use while at the start of the program.
num >=0. i need to use while at the start of the
please help me correct it. Thank you.

Problem 4 Write a program that reads a positive integer value, and compute the following sequence: If the value is even, halve it. If it's odd, multiply by 3 and add 1. Repeat this process until the value is 1, printing out each value. . Finally print out how many of these operations you performed. . Note: If the input value is less than 1, print a message containing the word Error and exit the program. This is how the output should look like: Initial value is: 9 Next value is: 28 Next value is: 14 Next value is: 7 Next value is: 22 Next value is: 11 Next Value 18: 34 1 1 2 while True: 3 num = = -1 4 num = = float(input("Enter a positive number") 5 if num >= 0 : 6 break 7 else: 8 print("Error") 9 if(num 2) == 0: 10 print("next value is", (num//2)) 11 else: 12 print("next value is", (num * 3 + 1))L 13 . W No WNHO 00

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!