Skip to content
Snippets Groups Projects
Commit 9b77ab24 authored by dhana surya's avatar dhana surya
Browse files

maths logic is added

parent 0757f6f2
No related branches found
No related tags found
No related merge requests found
# to create a math interpreter
# TODO Prompt the usr for the input
expression = input("Enter the arithmetic operation (x , y , z ) : ")
expression = input("Enter the arithmetic operation (+ , - , * , / ) in format (x , y , z ): ")
# TODO phrase the input into the component (x , y , z )
x , y , z = expression.split(" ")
x , z = int (x) , int (z) # type casting the two value
print(type(x) , type(z))
# TODO Evaluate the arithmetic expression
if y == "+":
result = x + z
elif y == "-":
result = x - z
elif y == "*":
result = x * z
elif y == "/":
result = x / z
else :
print("Enter the proper format OR this progam can do only the basic calculation ")
# TODO Format and output the result into the one decimal place
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment