0
Help me find what's wrong with this calculator progaram
import math Operator = input("select the operator(+,-,Ă,/,^,log):") if Operator== "+" or "-" or "Ă" or "/": a=float(input("Enter first number:")) b=float(input("Enter second number:")) if Operator=="+": print(a,"+",b,"=",a+b) elif Operator == "-": print(a,"-",b,"=",a-b) elif Operator == "Ă": print(a,"Ă",b,"=",a*b) elif Operator == "/": print(a,"/",b,"=",a/b) elif Operator == "^": c=float(input("Enter the number:")) d=float(input("Select the power:")) print(c,"^",d,"=",math.pow(c, d)) elif Operator == "log": e=float(input("Enter the number:")) f=float(input("Select logarithmic base:")) print("Log","(",e,")","=",math.log(e,f)) else: print("Invalid input ") It works for first four operators but fails for log and ^
3 Answers
0
Yes I have tried it and it works.But what I want is ,if I select operator log then inputs should be c=input("enter the number:")
d=input("select logarithmic base:")
I don't want to give input to a and b