Skip to content

Commit ecf99a4

Browse files
Exercise_9
1 parent 30f755f commit ecf99a4

File tree

3 files changed

+46
-9
lines changed

3 files changed

+46
-9
lines changed

.idea/workspace.xml

Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,5 +243,13 @@ In case of input data being supplied to the question, it should be assumed to be
243243

244244
```python
245245
def prog_5():
246+
x = input().split(",")
247+
print(x)
248+
list_ = []
249+
for a in x:
250+
list_.append(int(a))
251+
list_2 = [a for a in list_ if a % 5 == 0]
252+
print(list_2)
253+
prog_5()
246254
```
247255
* * *

Solution.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,33 @@ def prog_4():
197197
list_ = [x for x in set_]
198198
list_.sort()
199199
print(" ".join(x for x in list_))
200-
prog_4()
200+
# prog_4()
201+
202+
203+
# ========================= Question_9: ===========================================
204+
# Write a program which accepts a sequence of comma separated 4 digit binary numbers as its input
205+
# and then check whether they are divisible by 5 or not. The numbers that are divisible by 5 are
206+
# to be printed in a comma separated sequence.
207+
# Example:
208+
# 0100,0011,1010,1001
209+
# Then the output should be:
210+
# 1010
211+
# Notes: Assume the data is input by console.
212+
#
213+
# Hints:
214+
# In case of input data being supplied to the question, it should be assumed to be a console input.
215+
216+
217+
def prog_5():
218+
x = input().split(",")
219+
print(x)
220+
list_ = []
221+
for a in x:
222+
list_.append(int(a))
223+
list_2 = [a for a in list_ if a % 5 == 0]
224+
print(list_2)
225+
prog_5()
226+
227+
201228

202229
print("=============================================")

0 commit comments

Comments
 (0)