Tuesday 3 January 2017

PYTHON-math calculations +,-,*,/,%

>>> 1+1
2
>>> 12345+54321
66666
>>> 4-2
2
>>> 2*5
10

this is 2 power 5=32
>>> 2**5
32

this is 5 power 2=25
>>> 5**2
25

>>> print("1+2 is 3 its is addition", 1+2)
1+2 is 3 its is addition 3

>>> print("1-2 is -1 its is sub-ration 1-2 =",1-2)
1-2 is -1 its is sub-ration 1-2 = -1

>>> 21/3
7.0

>>> 23/3
7.666666666666667

>>> 23.0/3
7.666666666666667

>>> 23.0/3.0
7.666666666666667

>>> 23%3
2

>>> print("23%3 this will return the reminder",23%3)
23%3 this will return the reminder 2


>>> v=5
>>> v+5
10

>>> v**5
3125


No comments:

Post a Comment