is digit() python:  

  • The isdigit()  in python is defined as the string that consists of only digit values. 
  • It returns the result in boolean type if the string has only digits it returns true else false.
  • It accepts the Unicode of that characters also. and also the exponents like ^2.
  • It is not applicable to whitespace, special symbols, alphabets.
Syntax: str.isdigit().

Example:  str="123456"
                 str.isdigit(str) retrns true
Beacuse "123456" is perfectly a digit.
               str=\u00B0
               str.isdigit(str)returns true
Because it takes the Unicode as digit characters.

#write a python code  to demonstrate isdigit() function.

  1. a="7656734"
  2. a=str.isdigit(a)
  3. print(a)
  4. b="2344.60 
  5. b=str.isdigit(b)
  6. print(b)
  7. x="\u00B2"
  8. x=str.isdiigt(x)
  9. print(x)
output: true
            false
            true

2

Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu