From 9920293eda57d44a60ebfa2e60145adbcb2e2174 Mon Sep 17 00:00:00 2001 From: Viktor <81253033+Viktor-Kiptev@users.noreply.github.com> Date: Mon, 5 Dec 2022 14:48:15 +0100 Subject: [PATCH] Update Day 9.md Add a solution for question #28 --- Status/Day 9.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Status/Day 9.md b/Status/Day 9.md index e71b8fd..c117755 100644 --- a/Status/Day 9.md +++ b/Status/Day 9.md @@ -98,6 +98,27 @@ printValue("3","4") #7 sum = lambda s1,s2 : int(s1) + int(s2) print(sum("10","45")) # 55 ``` +**Solution by VK: Python 3** + +```python +def ConvertStrAndSum(): + counter = 0 + while counter == 0: + try: + value = input('Enter 2 value to sum it\n').split() + x, y = value + try: + x, y = int(x), int(y) + counter += 1 + return x + y + except ValueError as err: + print(err) + except ValueError or UnboundLocalError as err: + print(err) + +print(ConvertStrAndSum()) +``` + ---