Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calculator_1():
- ''' It is calculator.
- In first line you must write first number.
- In second the second number.
- In the third line must write math operation.
- In end you have result of this operation.'''
- a = input("Write first number :")
- b = input("Write second number :")
- c = input("Write the symbol:")
- if a == float(a):
- b = float(b)
- if b == float(b):
- a = float(a)
- if c == "%":
- print(float(a) % float(b))
- elif c == "^" and c == "**" :
- print(float(a) ** float(b))
- elif c == "+" :
- print(float(a) + float(b))
- elif c == "-" :
- print(float(a) - float(b))
- elif c == "/" :
- print(float(a) / float(b))
- elif c == "*" :
- print(float(a) * float(b))
- elif c == "//" :
- print(float(a) // float(b))
- elif c != ["-","+","/","*","^","%"]:#Массив
- print("Error:incorrect symbol...")
- print( calculator_1.__doc__ )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement