Skip to content

Commit 34998a0

Browse files
authored
Update Day 5.md
1 parent 14ef13b commit 34998a0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Status/Day 5.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,25 @@ while True:
195195
lst = list(int(i[2:]) if i[0] == 'D' else -int(i[2:]) for i in lines)
196196
print(sum(lst))
197197
```
198+
---
199+
```python
200+
'''Solution by: popomaticbubble
201+
'''
202+
transactions = []
198203

204+
while True:
205+
text = input("> ")
206+
if text:
207+
text = text.strip('D ')
208+
text = text.replace('W ', '-')
209+
transactions.append(text)
210+
else:
211+
break
212+
213+
transactions = (int(i) for i in transactions)
214+
balance = sum(transactions)
215+
print(f"Balance is {balance}")
216+
```
199217
---
200218

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

0 commit comments

Comments
 (0)