From 32fb9ccb1c1f5ec37e48e483aebd8f6eff32a1ba Mon Sep 17 00:00:00 2001 From: GANESH CHANDRAN Date: Thu, 19 Dec 2024 22:23:00 +0530 Subject: [PATCH] Add files via upload --- Day-20/Gaaanesh.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Day-20/Gaaanesh.py diff --git a/Day-20/Gaaanesh.py b/Day-20/Gaaanesh.py new file mode 100644 index 0000000..d0a439b --- /dev/null +++ b/Day-20/Gaaanesh.py @@ -0,0 +1,37 @@ +def greet(name): + + def message(): + return "How u doin :)!" + + return f"Sup, {name}. {message()}" +name=input("Enter you name:") +print(greet(name)) + + +def calculator(a, b): + def add(): + return a + b + + def subtract(): + return a - b + + def multiply(): + return a * b + + def divide(): + return a / b if b != 0 else "Division by zero!" + + return { + "add": add(), + "subtract": subtract(), + "multiply": multiply(), + "divide": divide() + } + +a=int(input("Enter a number:")) +b=int(input("Enter a number:")) +results = calculator(a,b) +print("Addition:", results["add"]) +print("Subtraction:", results["subtract"]) +print("Multiplication:", results["multiply"]) +print("Division:", results["divide"]) \ No newline at end of file