Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. x = float(input())
  2. y = float(input())
  3. operation = input()
  4.  
  5. if ((operation == '/' or
  6.      operation == 'mod' or
  7.      operation == 'div') and y == 0):
  8.     print('Деление на 0!')
  9. else:
  10.     if operation == '+':
  11.         print(x + y)
  12.     elif operation == '-':
  13.         print(x - y)
  14.     elif operation == '/':
  15.         print(x / y)
  16.     elif operation == '*':
  17.         print(x * y)
  18.     elif operation == 'mod':
  19.         print(x % y)
  20.     elif operation == 'pow':
  21.         print(x ** y)
  22.     elif operation == 'div':
  23.         print(x // y)
  24.     else:
  25.         print('ввели что-то странное, я бы тут очень ругался')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement