Advertisement
fensa08

#VI LAB1/1

Mar 18th, 2019
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. #VI LAB1/1 made by Fensa08
  2. # -*- coding: utf-8 -*-
  3. __operators = ('+', '-', '/', '//', '*', '**', '%')
  4.  
  5.  
  6. def calculator():
  7.     x = eval(input())
  8.     operator = eval(input())
  9.     y = eval(input())
  10.  
  11.   #  print(str(x) + operator + str(y))
  12.  
  13.     # your code here
  14.     rezultat = 0
  15.     if operator == "+":
  16.         rezultat = x + y
  17.     elif operator == '-':
  18.         rezultat = x - y
  19.     elif operator == '/':
  20.         rezultat = x / y
  21.     elif operator == '//':
  22.         rezultat = x // y
  23.     elif operator == '*':
  24.         rezultat = x * y
  25.     elif operator == '%':
  26.         rezultat = x % y
  27.     elif operator == '**':
  28.         rezultat = x ** y
  29.     else:
  30.         print("GRESKA PRI VNES")
  31.     print(rezultat)
  32.     return rezultat
  33.  
  34.  
  35. if __name__ == "__main__":
  36.     calculator()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement