Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

absolute value python

#find the absolute or modulous of the  number
a=int(input('enter number'))
if a>0:
    print('The absolute value of',a,'is',a)
else:
    print('The absolute value of',a,'is',-a)
#output:
#case I
enter number4
The absolute value of 4 is 4
#case II
enter number-4
The absolute value of -4 is 4
Source by coders911.org #
 
PREVIOUS NEXT
Tagged: #absolute #python
ADD COMMENT
Topic
Name
7+1 =