Question: Solve the question Trace the output of the following program and write the output in the space provided: def main ( ) : numl =

Solve the question Trace the output of the following program and write the output in the space provided:
def main():
numl =6
num2=9
num 3=2
num 4=10
resultSum =0
resultSubt =0
print("Initial values:" ,num1, num2,num3,num4)
for i in range (1,5) :
if i2 :
num 1+=1
num2-=1
num 3+=1
num4-=1
resultSum = performSum (num1, num2, num3, num4) print(num1, num2,num3,num4)
else:
num 1+=1
num2-=1
num 3+=1
num4-=1
resultSubt = performSubt(num1, num2, num3, num4) print(num1, num2,num3,num4)
print(resultSubt)
print(resultSum)
def performSum(n1,n2,n3,n4):
sumResult =n1+n2+n3+n4
n1+=1
n2-=4
n3+=2
n4+=3
retum sumResult
def performSubt(n1,n2,n3,n4):
subtResult =(n1+n2)-(n3+n4)
n1+=1
n2-=4
n3+=2
n4+=3
return subtResult
main() #Program begins here
 Solve the question Trace the output of the following program and

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!