Write a function listchange(Arr,N) in Python, which accepts a list Arr of numbers and N is an numeric value depicting length of the list. Modify the list so that all even numbers doubled and odd number multiply by 3
Sample Input Data of the list: Arr= [ 10,5,30,40,15,11], N=6
Output: Arr = [20,15,60,80,45,33]
Other questions:
Write a function listchange(Arr)in Python, which accepts a list Arr of numbers, the function will replace the even number by value 10 and multiply odd number by 5. Sample Input Data of the list is:
a=[10,20,23,45]
listchange(a,4)
output :
[10, 10, 115, 225]
Write definition of a method/function AddOddEven(VALUES) to display sum of odd and even values separately from the list of VALUES.
For example : If the VALUES contain [15, 26, 37, 10, 22, 13]
The function should display
Even Sum: 58
Odd Sum: 65
Write the definition of a function Alter(A, N) in python, which should change all the odd numbers in the list to 1 and even numbers as 0.
Write the definition of a function Alter(A, N) in python, which should change all the multiples of 5 in the list to 5 and rest of the elements as 0.
#education #computerscience #tutorial #computers #python #pythonprogramming #pythontutorial #pythonforbeginners #pythonbeginner