Engineering

Python 3Sum Positive FloatsWrite a program that reads in an arbitrary number of floating point values and then prints the sum of all the positive values entered, rounded to three decimal places. The value 0 will indicate the end of input. Note that negative input values should not be added to the sum.Input Format For Custom TestingEach line of input will contain a floating point value, and the last line of input will contain the number 0.Sample Case 1Sample Input For Custom Testing3.52-17.92350Sample Output33.500Sample Case 2Sample Input For Custom Testing0-----------------------------------------------------------------------------------Collatz ConjectureThe Collatz Conjecture is a conjecture in mathematics that concerns a sequence defined as follows: start with any positive integer n. Then, each term in the sequence is obtained from the previous term as follows: if the previous term is even, the next term is one-half the previous term. If the previous term is odd, the next term is 3 times the previous term plus 1. The conjecture is that no matter what the value of n is, the sequence will always reach 1. For example, the Collatz sequence starting from 3 is 3, 10, 5, 16, 8, 4, 2, 1 and it has a length of 8, since there are 8 terms in the sequence. Write a program that reads in the value of n and prints out how many terms are in the Collatz sequence starting with n.Input Format For Custom TestingThe only line of input contains the positive integer n.Sample Case 1Sample Input For Custom Testing3Sample Output8Sample Case 2Sample Input For Custom Testing1Sample Output1Sample Case 3Sample Input For Custom Testing6Sample Output9Sample Output0.000Sample Case 3Sample Input For Custom Testing3.14159-20-420-0.0040Sample Output3.142