From 3149c7440fc18a74313f9cdca2ddfe46defe6f82 Mon Sep 17 00:00:00 2001 From: atharvp Date: Sun, 16 Feb 2025 02:59:41 +0530 Subject: [PATCH 1/2] Fix Space in line 57 --- Calculator/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Calculator/main.py b/Calculator/main.py index 599cbc0..ca1d648 100644 --- a/Calculator/main.py +++ b/Calculator/main.py @@ -54,8 +54,7 @@ def calculator(): else: print(f"{num1} {operation_symbol} {num2} = {answer}") - if input(f"Type 'y' to continue calculating with {answer},\ - or type 'n' to start a new calculation: ") == "y": + if input(f"Type 'y' to continue calculating with {answer}, or type 'n' to start a new calculation: ") == "y": num1 = answer else: should_continue = False From da0c2a492378c5aedb562e2b20179588db370fe3 Mon Sep 17 00:00:00 2001 From: atharvp Date: Sun, 16 Feb 2025 03:08:50 +0530 Subject: [PATCH 2/2] Adding Exit Feature --- Calculator/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Calculator/main.py b/Calculator/main.py index ca1d648..45d1b0d 100644 --- a/Calculator/main.py +++ b/Calculator/main.py @@ -53,9 +53,14 @@ def calculator(): print(f"{num2} {operation_symbol} {num1} = {answer}") else: print(f"{num1} {operation_symbol} {num2} = {answer}") + + end=input(f"Type 'y' to continue calculating with {answer}, or type 'n' to start a new calculation or type 'exit' to end calculation : ") + - if input(f"Type 'y' to continue calculating with {answer}, or type 'n' to start a new calculation: ") == "y": + if end == "y": num1 = answer + elif end.lower()== "exit": + break else: should_continue = False calculator()