Answers for "check negative number in python"

1

how to check if number is negative in python

num = -10

if num < 0:
  print(f"number you entered:{num} is negative")
Posted by: Guest on June-25-2021
-1

check negative number in python

number_to_check = input("enter a number: ")

try:
    if number_to_check < 0:
        print("That number is a negative number")
    else:
        print("That number is not a negative number")

# Error handling, in case input was a string
except TypeError:
    print("That wasn't a number")
Posted by: Guest on August-06-2021
-2

how to make a negative number positive in python

x = abs(x)
Posted by: Guest on August-26-2021

Code answers related to "check negative number in python"

Python Answers by Framework

Browse Popular Code Answers by Language