a basic code for calculator
See original GitHub issuehi…i’m new to python and this is my basic code for the calculator which you can add
a=int(input("enter any number: "))
b=int(input("enter another number: "))
ope=input("enter the operand: ")
if ope=="+":
print(a+b)
elif ope=="-":
print(a-b)
elif ope=="*":
print(a*b)
elif ope=="/":
print(a/b)
else:
print("invalid operand ,try again")
sounds cool?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Python Program to Make a Simple Calculator - Programiz
In this example you will learn to create a simple calculator that can add, subtract, multiply or divide depending upon the input from...
Read more >Basic calculator program using Python - GeeksforGeeks
Here we will be making a simple calculator in which we can perform basic arithmetic operations like addition, subtraction, multiplication, ...
Read more >How to build an HTML calculator app from scratch using ...
This is an epic article where you learn how to build a calculator from scratch. We'll focus on the JavaScript you need to...
Read more >How to Build a Simple Calculator Using HTML, CSS, and ...
Simple, calculated code is the way to go when programming. Check out how to build your own calculator in HTML, CSS, and JS....
Read more >Python make simple Calculator - Javatpoint
Python Program to Make a Simple Calculator. In Python, we can create a simple calculator for performing the different arithmetical operations, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try this :
print(“”" =========================== Simple Calculator =========================== Please select an operation:
“”") choice=input("Please enter choice(1/2/3/4)😊 num1 = int(input("Enter first number: ")) num2 = int(input("Enter second number: "))
if choice == ‘1’: print(num1,“+”,num2,“=”, num1+num2) elif choice == ‘2’: print(num1,“-”,num2,“=”, num1-num2) elif choice == ‘3’: print(num1,““,num2,”=", num1num2) elif choice == ‘4’: print(num1,”/“,num2,”=", num1/num2) else: print(“Invalid input”)
Hi,
Operand? Do you mean Operator?
All good otherwise 🙂