Advertisement
Prokchor_Unicorn

Operators in Python

Nov 17th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. print("Here you will see the examples of all operators that python has.")
  2. print("1. Enter your first value.")
  3. x = input()
  4. x = float(x)
  5. print("2. Enter your second value.")
  6. y = input()
  7. y= float(y)
  8. addition = x + y
  9. substraction = x - y
  10. abssubstraction = abs(substraction)
  11. multiplication = x * y
  12. division1 = x / y
  13. division2 = int(x // y)
  14. power = x ** y
  15. multiplication2 = round(multiplication)
  16. remainder = x % y
  17. print(f'Addition of your numbers produces [ {addition} ].')
  18. print(f'Substraction of your numbers produces [ {substraction} ].')
  19. print(f'Multiplication of your numbers produces [ {multiplication} ].')
  20. print(f'Division of your numbers  with decimals produces [ {division1} ].')
  21. print(f'Division of your numbers  without decimals produces [ {division2} ].')
  22. print(f'Making your first number to the power of second gives us [ {power} ].')
  23. print(f'Rounded multiplication of your numbers produces [ {multiplication2} ].')
  24. print(f'Remainder of your numbers produces [ {remainder} ].')
  25. print(f'Absolute numberof your substraction gives us [ {abssubstraction} ].')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement