In: Computer Science
IN PYTHON PLEASE
Create a file lists.py that contains the following functions:
sumOfOdd(intList)
productOfEven(intList)
evenMembers(intList)
changeList(intList)
isReverse(intListOne, intListTwo)
def sumOfOdd(intList):
oddSum=0
for i in range(0,len(intList),1):
if(intList[i]%2!=0):
oddSum=oddSum + intList[i]
print("oddSum=",oddSum)
def productOfEven(intList):
productEven=1
for i in range(len(intList)):
if(intList[i]%2==0):
productEven = productEven * intList[i]
print("product EVen=",productEven)
def evenMembers(intList1):
listt=[]
for i in range(len(intList1)):
if(intList1[i]%2==0):
listt.append(intList1[i])
print("change of even num to another list=",listt)
print("original list=",intList1)
def changeList(intList):
for i in range(len(intList)):
one=1
if (intList[i]%2 == 0):
intList[i]=(intList[i] * 3)
if(intList[i]%2 !=0):
intList[i]=intList[i]+one
intList[i]=int(intList[i]/2)
print("change of current list=",intList)
def isReverse(intListOne, intListTwo):
intListOne.reverse()
if(intListOne == intListTwo):
return True
else:
return False
intList=[1,2,3,4]
intList1=[1,2,3,4,2,3,6]
b=[1,2,3,4]
c=[4,3,2,1]
sumOfOdd(intList)
productOfEven(intList)
evenMembers(intList1)
changeList(intList)
a=isReverse(b,c)
print("reverse check=",a)
regarding any concerns about above code please mention in comments thankyou