**In mathematics, a negative number is a real number less than 0. **For example, -2, -67.87, -34, -0.564 all are negative numbers. This article discusses different approaches to check if a number is negative in python.

Let us consider the following example. A user-defined function **negative** checks if a number is less than 0. If the condition is **True**, the program executes the if Statement, and output is printed.

```
def negative( num ):
if num<0:
print(num, " is negative")
else:
print(num, "is not negative")
negative(4)
negative(-5)
negative(0)
```

The above program gives output as

```
4 is not negative
-5 is negative
0 is not negative
```

A function negative is defined to check if the number is negative. The **str()** function converts the number to a string data type. The** if statement** checks if the first character of the string is equal to the hyphen **'-'. **If the condition is True, the number is a negative number.

```
def negative( num ):
str_num = str(num)
if str_num[0] == '-':
print(num, " is negative")
else:
print(num, "is not negative")
negative(4)
negative(-5)
negative(0)
```

Output

```
4 is not negative
-5 is negative
0 is not negative
```

- How to get the last element of a list in python?
- How to get absolute value in Python?
- How to check the type of a variable in python?
- How to capitalize the first letter in python?
- What does ord() function do in python?
- How to shuffle a list in python?
- How to remove a key from a dictionary python?
- How to Typecast in Python?