Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. def calculator_1():
  2. ''' It is calculator.
  3. In first line you must write first number.
  4. In second the second number.
  5. In the third line must write math operation.
  6. In end you have result of this operation.'''
  7. a = input("Write first number :")
  8. b = input("Write second number :")
  9. c = input("Write the symbol:")
  10. if a == float(a):
  11. b = float(b)
  12. if b == float(b):
  13. a = float(a)
  14. if c == "%":
  15. print(float(a) % float(b))
  16. elif c == "^" and c == "**" :
  17. print(float(a) ** float(b))
  18. elif c == "+" :
  19. print(float(a) + float(b))
  20. elif c == "-" :
  21. print(float(a) - float(b))
  22. elif c == "/" :
  23. print(float(a) / float(b))
  24. elif c == "*" :
  25. print(float(a) * float(b))
  26. elif c == "//" :
  27. print(float(a) // float(b))
  28. elif c != ["-","+","/","*","^","%"]:#Массив
  29. print("Error:incorrect symbol...")
  30. print( calculator_1.__doc__ )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement