KnowledgeBoat Logo

Computer Science

Carefully go through the code given below and answer the questions based on it :

inputStr = input(" Give me a string:")
biglnt = 0
littlelnt = 0
otherlnt = 0
for ele in inputStr:
    if ele >= 'a' and ele <= 'm':     # Line 1
        littlelnt = littlelnt + 1
    elif ele > 'm' and ele <= 'z':
        biglnt = biglnt + 1
    else:
        otherlnt = otherlnt + 1
print (biglnt)             # Line 2
print (littlelnt)          # Line 3
print (otherlnt)           # Line 4
print (inputStr.isdigit()) # Line 5

Given the input 1+2 =3 what output is produced by Line 5?

  1. 0
  2. 1
  3. True
  4. False
  5. None of these

Python String Manipulation

1 Like

Answer

Option 4 — False

Explanation

As all characters in the input string 1+2 =3 are not digits hence isdigit() returns False.

Answered By

2 Likes


Related Questions