0% found this document useful (0 votes)
2 views1 page

Untitled Document

This document describes a simple calculator implemented in Python that performs basic arithmetic operations such as addition, subtraction, multiplication, and division. It serves as a teaching tool for basic programming concepts and can be a foundation for more complex applications. Additionally, it can be integrated into user-friendly tools for non-programmers.

Uploaded by

imransheikkh1996
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Untitled Document

This document describes a simple calculator implemented in Python that performs basic arithmetic operations such as addition, subtraction, multiplication, and division. It serves as a teaching tool for basic programming concepts and can be a foundation for more complex applications. Additionally, it can be integrated into user-friendly tools for non-programmers.

Uploaded by

imransheikkh1996
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

9.

Simple Calculator
python
CopyEdit
def calculator():
print("Simple Calculator")
num1 = float(input("Enter first number: "))
operator = input("Enter operator (+, -, *, /): ")
num2 = float(input("Enter second number: "))

if operator == "+":
return num1 + num2
elif operator == "-":
return num1 - num2
elif operator == "*":
return num1 * num2
elif operator == "/":
return num1 / num2
else:
return "Invalid operator"

# Example usage:
print(calculator())

Description:
This is a simple calculator that performs basic arithmetic operations. It's useful in building more
complex applications like financial software or as part of interactive tools in command-line
interfaces.

Usefulness:

● Teaching basic programming concepts

● Foundation for building more advanced software

● Can be part of user-friendly tools for non-programmers

You might also like