Skip to content

Commit 144998b

Browse files
committed
2 parents 7bba5e4 + 9b87af5 commit 144998b

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

Status/Day 2.md

+13
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,19 @@ for line in map(str.upper, user_input()):
439439
print(line)
440440
```
441441

442+
```python
443+
'''Soltuion by: hajimalung baba
444+
'''
445+
def inputs():
446+
while True:
447+
string = input()
448+
if not string:
449+
return
450+
yield string
451+
452+
print(*(line.upper() for line in inputs()),sep='\n')
453+
```
454+
442455
---
443456

444457
[**_go to previous day_**](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%201.md "Day 1")

Status/Day 3.md

+31
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ data = [num for num in data if int(num, 2) % 5 == 0]
172172
print(','.join(data))
173173
```
174174

175+
```python
176+
'''Solution by: hajimalung baba
177+
'''
178+
print(*(binary for binary in input().split(',') if int(binary,base=2)%5==0))
179+
```
180+
175181
---
176182

177183
# Question 12
@@ -246,6 +252,17 @@ print(",".join(lst))
246252
print(','.join([str(num) for num in range(1000, 3001) if all(map(lambda num: int(num) % 2 == 0, str(num)))]))
247253
```
248254

255+
```python
256+
'''Solution by: hajimalung
257+
'''
258+
from functools import reduce
259+
#using reduce to check if the number has only even digits or not
260+
def is_even_and(bool_to_compare,num_as_char):
261+
return int(num_as_char)%2==0 and bool_to_compare
262+
263+
print(*(i for i in range(1000,3001) if reduce(is_even_and,str(i),True)),sep=',')
264+
```
265+
249266
---
250267

251268
# Question 13
@@ -350,6 +367,20 @@ for item in sen:
350367
digit += 1
351368
print(f"LETTERS : {alp} \n DIGITS : {digit}")
352369
```
370+
```python
371+
'''Solution by: hajimalung
372+
'''
373+
#using reduce for to count
374+
from functools import reduce
375+
376+
def count_letters_digits(counters,char_to_check):
377+
counters[0] += char_to_check.isalpha()
378+
counters[1] += char_to_check.isnumeric()
379+
return counters
380+
381+
print('LETTERS {0}\nDIGITS {1}'.format(*reduce(count_letters_digits,input(),[0,0])))
382+
```
383+
353384
---
354385

355386
## Conclusion

0 commit comments

Comments
 (0)