0
Code
How to solve a simple calculation using codes
2 Answers
+ 1
Declare a variable and then just write whatever you want to calculate. Its the same as your scientific calculator. Example,
x = 1+2*3+6/3+(3-1)
print(x)
Bit advanced:
If you want to take the expression as input, then do this,
y = input()
x = eval(y)
print(x)
+ 1
Lufungulo Jackson Twange
# define functions.
def add(x, y):
"""This function adds two numbers""
return x + y.
def subtract(x, y):
"""This function subtracts two numbers"""
return x - y.
def multiply(x, y):
https://www.javatpoint.com/JUMP_LINK__&&__python__&&__JUMP_LINK-make-simple-calculator