is numeric:
- Is numeric is the built-in method that is used to check whether the string contains numbers or not.
- It returns the true when the string contains numbers, if the string does not contain numbers then it returns false.
- It is applicable for integers, Unicode values. and takes the exponents like 1/2.
- It is not applicable for float and negative values.
- isnumeric does not have any parameters.
- For negative values to check whether they are numeric or not we have to remove the negative sign.
Example: a="12345"
a=str.isnumeric(a)
true
#write a python program to demonstrate the isnumeric function.
- x="34567"
- x=str.isnumeric(x)
- print(x)
- y="123abc"
- y=str.isnumeric(y)
- priny(y)
- z="asd13434656"
- z=str.isnumeric(z)
- print(z)
output: true
false
false
No comments