- Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathbinary_numbers.py
More file actions
Latest commit
24 lines (21 loc) · 504 Bytes
/
Copy pathbinary_numbers.py
File metadata and controls
24 lines (21 loc) · 504 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
"""
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
"""
value= []
items=[xforxinraw_input().split(',')]
forpinitems:
intp=int(p, 2)
ifnotintp%5:
value.append(p)
print','.join(value)
"""
output:
1011,1101,1010,1001
1010
"""