Skip to content

Commit 9920293

Browse files
Update Day 9.md
Add a solution for question darkprinx#28
1 parent d12bde7 commit 9920293

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Status/Day 9.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,27 @@ printValue("3","4") #7
9898
sum = lambda s1,s2 : int(s1) + int(s2)
9999
print(sum("10","45")) # 55
100100
```
101+
**Solution by VK: Python 3**
102+
103+
```python
104+
def ConvertStrAndSum():
105+
counter = 0
106+
while counter == 0:
107+
try:
108+
value = input('Enter 2 value to sum it\n').split()
109+
x, y = value
110+
try:
111+
x, y = int(x), int(y)
112+
counter += 1
113+
return x + y
114+
except ValueError as err:
115+
print(err)
116+
except ValueError or UnboundLocalError as err:
117+
print(err)
118+
119+
print(ConvertStrAndSum())
120+
```
121+
101122

102123
---
103124

0 commit comments

Comments
 (0)