CBSE Class 11 Computer Science Question 51 of 91

String Manipulation — Question 11

Back to all questions
11
Question

Question 11

Try to find out if for any case, the string functions isalnum( ) and isalpha( ) return the same result

Answer

isalnum( ) and isalpha( ) return the same result in the following cases:

  1. If string contains only alphabets then both isalnum( ) and isalpha( ) return True. For example, "Hello".isalpha() and "Hello".isalnum() return True.
  2. If string contains only special characters and/or white-spaces then both isalnum( ) and isalpha( ) return False. For example, "*#".isalpha() and "*#".isalnum() return False.
Answer