Advertisement
Guest User

Untitled

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