Computer Science, asked by ritikgrover8782, 10 months ago

Write the syntax of isdecimal( ) and give suitable example

Answers

Answered by shrutisingh089
2

Write the syntax of isdecimal( ) and give suitable example

Answered by letmeanswer12
2

Syntax details of isdecimal( ) method

Explanation:

The isdecimal() method of python string tests whether the string comprises only decimal characters. This process only exists on artifacts with unicode.

  • Syntax - str.isdecimal()
  • Parameters - None
  • Return Value - This returns true if all of the string characters are decimal, else false.

The following example shows the usage of isdecimal() method.

  • #!/usr/bin/python
  • # contains numbers
  • s = "12345"
  • print(s.isdecimal())  
  • True
  • # contains alphabets  
  • s = "12abcd34"
  • print(s.isdecimal())  
  • False
  • # contains numbers and spaces  
  • s = "12 34"
  • print(s.isdecimal())  
  • False

Similar questions