Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

NEED HELP ON PYTHON A “Mezza Pinta\" sequence is a series of values starting wit

ID: 3910436 • Letter: N

Question

NEED HELP ON PYTHON

A “Mezza Pinta" sequence is a series of values starting with zero, then alternatively subtracting and adding subsequent integers, which increment by a Mezza Pinta Step. If the Mezza Pinta Step was1 the values in this sequence would be 0, +1, -2, +3, -4, +5, -6.... and when these values are summed they produce the sequence: 0, 1, -1, 2, -2, 3, -3. In this case, the 5th index is 3 The values with a Mezza Pinta Step of 3 would be: 0, 3, -6, 9, -12, 15... and would produce the sequence: 0, 3, -3, 6, -6, 9. The 2nd index is -3 and the 4th index is -6. (keep in mind that the index of a Mezza Pinta series always starts with zero) Write a function named q4 ) that accepts two (2) integers from the user a Mezza Pinta Step and n Your program should then calculates the nth index in the sequence Example output This program determines the nth index This program determines the ntlh of a Mezza Pinta Sequence. of a Mezza Pinta Sequence. Enter the Mezza Pinta Step: 3 Enter the value for n: 6 The 6th index with Mezza Pinta Step 3 ?s -9 | The 14th index with Mezza Pinta Step 5 IS -35 Enter the Mezza Pinta Step: 5 Enter the value for n: 14 This program determines the nth This program determines the nth index of a Mezza Pinta Sequence of a Mezza Pinta Sequence Enter the Mezza Pinta Step: 6 Enter the value for n: 96 The 96th index with Mezza Pinta Step 6 is -288 he 33th index with Mezza Pinta Step 8 is 136 Enter the Mezza Pinta Step: 8 Enter the value for n: 33

Explanation / Answer

print('This program determines the nth index of a Mezza Pinta Sequence ')
step = int(input('Enter the Mezza Pinta Step:'))
n = int(input('Enter the value for n:'))
t = step
count = 2
while count <= n:
count += 1
if count % 2 == 0:
t = -t + step
else:
t = -t
print('The', n, 'index with Mezza Pinta Step', step, 'is', t)

**Comment for any further queries. Upvote if the answer is satisfactory