Home
Home
Articles
FLL Robotics
Sponsers
Articase
About Us
Facts
Space_facts
Technology Facts
Animal Facts
About
Hobbies
Raspberry Pi
What Is Raspberry pi
Skeches
Books
Coding
Python Projects
PyCalulater
Python Calculater
This Page is currently down for maintenance.
Python Try It Editor
Python Try-It Editor
# Simple Calculator in Python def add(x, y): return x + y def subtract(x, y): return x - y def multiply(x, y): return x * y def divide(x, y): return x / y if y != 0 else "Error: Division by zero" print("Select Operation: +, -, *, /") op = input("Enter operator: ") num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) if op == '+': print(f"Result: {add(num1, num2)}") elif op == '-': print(f"Result: {subtract(num1, num2)}") elif op == '*': print(f"Result: {multiply(num1, num2)}") elif op == '/': print(f"Result: {divide(num1, num2)}") else: print("Invalid Operator")
Run Code