Calculator in Python PYTHON by Ravinder Nath Rajotiya - April 19, 2019June 10, 20190 Share on Facebook Share Send email Mail Print Print Calculator In python calculator is at primary prompt. Just write any expression and you get the answer. Numbers: do the following a primary command prompt. Figure 1.1.1 Calculator So, you have an inbuilt calculator, we can write complex expression, it is always better to enclose them in parenthesis. See example below: 1.1.2 Expressions A division operator always leaves the result as float. So 5/2=2.5 Whereas a floor operator (//) discard the fraction part, so 10/3= 3 Other operators are +, -, *, /, %, //, **, = In python last printed expression is assigned to variablele _ Example-1 Example-2 >>> x,y= 10,5 >>>z= x*y >>>w=_ + 5 >>>w 55 Note that now z =x*y to _ and add 5 to it to get 10*5 + 5 = 55 >>> tax = 12.5 / 100 >> >price = 100.50 >>>price * tax12.5625 >>> price + _113.0625 round(_, 2)113.06 Share on Facebook Share Send email Mail Print Print