def e_o(n): #called function
l=[] # empty list
for i in range(n):
num=int(input("enter the number:"))
l.append(num)
for j in range(n):
if l[j]%2==0:
l[j]=l[j]*10
else:
l[j]=l[j]//5
print("updated list elements=",l)
#main program
n=int(input("enter n value:"))
print("the n value is=",n)
e_o(n) #calling function
Example:
enter n value:4
the n value is= 4
enter the number:12 enter the number:15 enter the number:20 enter the number:25
updated list elements= [120, 3, 200, 5]
No comments:
Post a Comment