Skip to content
  • Tutorials
    • c programming
      • libraries
    • c++
    • Linux
    • Python
    • batch programming
    • Technology
  • IDE
  • Tools
python convert any number in positive 1

python convert any number in positive

June 23, 2022 by Anurag batra
a = abs(-1)
return a

#returns 1

Here is what the above code is Doing:
1. The function is called with the argument -1.
2. The function creates a variable a and assigns it the value of the absolute value of -1.
3. The function returns the value of a.
4. The function call evaluates to 1.

Categories Python Examples
Post navigation
how to make a resizable python tkinter window have a limit
indices of true boolean array pyton
© MyEduKit - 2022 . All Rights Reserved.