Question: Please answer the following question in PYTHON. I have asked this question twice before and it was wrong so please try to match the error.
Please answer the following question in PYTHON. I have asked this question twice before and it was wrong so please try to match the error. I will paste the old code and the errors, thank you in advance.
34.9 LAB: Number pattern
Write a recursive function called print_num_pattern() to output the following number pattern.
Given a positive integer as input (Ex: 12), subtract another positive integer (Ex: 3) continually until a negative value is reached, and then continually add the second integer until the first integer is again reached. For this lab, do not end output with a newline.
Do not modify the given main program.
Ex. If the input is:
12 3
the output is:
12 9 6 3 0 -3 0 3 6 9 12
Starter Code
# TODO: Write recursive print_num_pattern() function
if __name__ == "__main__": num1 = int(input()) num2 = int(input()) print_num_pattern(num1, num2)
Existing Code
def print_num_pattern(num1, num2): if num1
if __name__ == "__main__": num1 = int(input()) num2 = int(input()) print_num_pattern(num1, num2)
Errors


Output differs. See highlights below. Input Your output. Expected output 2:Compare output Output differs. See highlights below. Your output. Expected output 3:Compare output Output differs. See highlights below. Your output. Expected output Output differs. See highlights below. Input82 Your output Expected output 5-Unit test Tests print_num_pattern() correctly creates and outputs number pattern print_num_pattern() function incorrectly creates or outputs number pattern. num1: 2 num 2:1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
