100+ Python challenging programming exercises 2
Question 11
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
Notes: Assume the data is input by console.
Hints: In case of input data being supplied to the question, it should be assumed to be a console input.
问题:编写一个接受逗号分隔的4位二进制数字序列作为输入的程序,然后检查它们是否可以被5整除。可被5整除的数字将以逗号分隔的顺序打印。
示例:0100001110101001那么输出应该是:1010
注意:假设数据是通过控制台输入的。
提示:在向问题提供输入数据的情况下,应该假设它是控制台输入。
Solution: