# How to check if a Character Is a Number in Python

hello guys. How are you? I hope you all fine. In this tutorial we will learn about how to check if a Character Is a Number in Python. So without wasting time lets learn about of this.

## How to check if a Character Is a Number in Python

1. ##### check if a Character Is a Number in Python

To check if a Character Is a Number in Python Just Use isdigit() you can easily check the character you entered is a number or not. so lets see this through an example:`var1 = "19" var2 = var1.isdigit() print(var2)` Output : `True` In the output you can see true. So by this method you can know about the character which you entered is number or not.

2. ##### How to check if a Character Is a Number in Python

To check if a Character Is a Number in Python Use if else you can check the character is a number or not. Lets learn this through an example: `inp = input("Enter The character that you want to check for int:") if(inp >= '0' and inp <= '9'): print("It is a Number") else: print("It is Not a Number")` Output : `Enter The character that you want to check for int:9 It is a Number`

## Method 1: Using isdigit()

In this method by using isdigit() you can easily check the character you entered is a number or not. so lets see this through an example:

``````var1 = "19"
var2 = var1.isdigit()
print(var2)``````

Output :

``True``

In the output you can see true. So by this method you can know about the character which you entered is number or not.

## Method 2: Using if else

By using if else you can check the character is a number or not. Lets learn this through an example:

``````inp = input("Enter The character that you want to check for int:")
if(inp >= '0' and inp <= '9'):
print("It is a Number")
else:
print("It is Not a Number")``````

Output :

``````Enter The character that you want to check for int:9
It is a Number``````

## Method 3: Using isnumeric()

In this method by using isnumeric() you can easily check the character you entered is a number or not. so lets see this through an example:

``````var1 = "19"
var2 = var1.isnumeric()
print(var2)``````

Output :

``True``

## Conclusion

It’s all About this Tutorial. Hope all methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which method worked for you?