-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathT2.py
More file actions
34 lines (26 loc) · 646 Bytes
/
T2.py
File metadata and controls
34 lines (26 loc) · 646 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
myarr = [58114, 10, 3430, 632, 4222]
# x = int(input("pls enter value for the array "))
#for i in range(5):
# myarr.append(x)
def sum_digit(n):
s = 0
while n:
s += n % 10
n //= 10
return s
def leading(m):
m = str(m)
return int(m[0])
def weirdfilter(arr):
"""this is actually on our TO DO list to go through"""
#arr = []
print(arr)
for i,number in enumerate(arr):
if sum_digit(number) % 2 == 0 or leading(number) == len(str(number)):
#number
#pass
arr[i]=number
else:
arr[i]=-1
return arr
print(weirdfilter(myarr))