Basic calculator.

Basic calculator.

By Tryadav

 def calculator():

print (("Calculator By Toyaj yadav\n"))

print (("please choose one of the following options ( + , - , / , * )\n"))

A = input ("Enter :- ")

B = input ("number 1 :-  ")

C = input ("number 2 :-  ")


if A == "+":

ans=(float(B)+float(C))

print((str(B)+(A)+(C)+(" = "))+(str(ans)))

elif A == "-":

ans=(float(B)-float(C))

print((str(B)+(A)+(C)+(" = "))+(str(ans)))

elif A == "*":

ans=(float(B)*float(C))

print((str(B)+(A)+(C)+(" = "))+(str(ans)))

elif A == "/":

ans=(float(B)//float(C))

print((str(B)+(A)+(C)+(" = "))+(str(ans))) 

elif A:

print(("SAMETHING IS WRONG !!!!!\n"))

again()


def again():

    Z=input("Do you want to calculate again? Please type y for YES or x for No \n Enter :- ")

    if Z== "y":

        calculator()

    elif Z== "x":

        print("THANK YOU FOR USE ")

    else:

        again()


calculator() 


Run



Comments

Post a Comment

Popular posts from this blog

Game guesses the number.

Game rock, paper, scissor in python