Create New Python File Sequencegenpy Write Function Sequence Takes One Parameter N Initial Q37243809

Create a new Python file sequencegen.py and write the functionsequence that takes one parameter: n, which is the initial value ofa sequence of integers. The 3n + 1 sequence starts with an integer,n in this case, wherein each successive integer of the sequence iscalculated based on these rules: 1. If the current value of n isodd, then the next number in the sequence is three times thecurrent number plus one. Note: Make sure to use integer division.2. If the current value of n is even, then the next number in thesequence is half of the current number. 3. Integers in

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.