Write a Program to Find Out Absolute Value of an Input Number in Python
Hi, in this blog lets try to solve how to get an absolute value of given number in python programming language.
Given the negative or positive number for example - 14 or + 14 The absolute value of any negative number or a positive number is just a number for example in the above -14, +14 the value will be just a number that is a 14 is a absolute value of a given number
Let's take a variable number and ask user to enter the number and convert it to integer type using int() Function call. the user enters an integer so it will be stored in the variable number and now let's use abs() function to convert the number to its absolute value.
abs() function takes an argument as a number either a positive or negative and returns the absolute value number. Let's tour this absolute value into another variable abs_value. Once we get the absolute value print the absolute value as a output using print function call
Python Program to Find Out Absolute Value of an Input Number
Absolute Value of Number is : 14
0 Comments