Jan-31-2023, 09:52 AM
Hi Python Community,
Greetings to you all !
After the if statement is passed through Reven and Rodd have to take two alternative indexes: one has to do multiply, and another has to do add.
like example,
Greetings to you all !
After the if statement is passed through Reven and Rodd have to take two alternative indexes: one has to do multiply, and another has to do add.
like example,
Output:array has {0,1,2,3,4,5,6,7,8,9}
Reven = ((((A[0]*A[2])+A[4])*A[6])+A[8])
like
0 +2
2 *4
8 +6
14 *8
array has {0,1,2,3,4,5,6,7,8,9}
Reven = ((((A[1]*A[3])+A[5])*A[7])+A[9])
like
1 + 3
4 * 5
20 +7
27 * 8
wriiten code def AddMult(A): Reven = 0 Rodd = 0 for i in range(len(A)): if i % 2 == 0: Reven = Reven + A[i] else: Rodd = Rodd + A[i] E = (Reven%2) O = (Rodd%2) if(O > E): return "ODD" elif(E > O): return "EVEN" elif(O == E): return "NEUTRAL"Could you please help me solve this?