- Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathq11.py
18 lines (11 loc) · 550 Bytes
/
q11.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Question:
# Write a program which accepts a sequence of comma separated 4 digit binary numbers as its input and then check whether they are divisible by 5 or not. The numbers that are divisible by 5 are to be printed in a comma separated sequence.
# Example:
# 0100,0011,1010,1001
# Then the output should be:
# 1010
# Function to convert Binary number
# to Decimal number
data=input().split(',')
data=list(filter(lambdai:int(i,2)%5==0,data)) # lambda is an operator that helps to write function of one line
print(",".join(data))