I want to iterate through the elements in the array and double the value of the number whenever an element equals a number. Also need to find the maximum number.
Here is my code which is incorrect.
def doubnum(arr,num):
for i in arr:
if i==num:
num=num*2
return num
doubnum([1,2,4,11,12,8],2)
Any help will be greatly appreciated.