Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #7018

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Dev #7018

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions Add Code Here/calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
class Calculator:
def __init__(self):
pass

def add(self, a, b):
return a + b

def sub(self, a, b):
return a - b

def mult(self, a, b):
return a * b

def div(self, a, b):
if b != 0:
return a // b
else:
return "Division by zero is not allowed"

class Calculator:
def __init__(self):
self.calculator = Calculator()

def display_menu(self):
print("1. Addition")
print("2. Subtraction")
print("3. Multiplication")
print("4. Division")

def process_choice(self):
while True:
choice = int(input("Enter Choice (1-4): "))
if choice in [1, 2, 3, 4]:
a = int(input("Enter 1st number: "))
b = int(input("Enter 2nd number: "))

if choice == 1:
print(self.calculator.add(a, b))
elif choice == 2:
print(self.calculator.sub(a, b))
elif choice == 3:
print(self.calculator.mult(a, b))
elif choice == 4:
print(self.calculator.div(a, b))
else:
print("Invalid choice. Exiting...")
break


# Create an instance of the ZeroDay class and run the program
if __name__ == "__main__":
Calculator = Calculator()
Calculator.display_menu()
Calculator.process_choice()
4 changes: 4 additions & 0 deletions content/ilyas829.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: ilyas829
institution: SIBAR
github:[**ilyas829**](https://github.com/ilyas829)
Ilyas was here