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 Hi Mom what output is produced by Line 3?
- 0
- 1
- 2
- 3
- None of these
Related Questions
Carefully go through the code given below and answer the questions based on it :
testStr = "abcdefghi" inputStr = input ("Enter integer:") inputlnt = int(inputStr) count = 2 newStr = '' while count <= inputlnt : newStr = newStr + testStr[0 : count] testStr = testStr[2:] #Line 1 count = count + 1 print (newStr) # Line 2 print (testStr) # Line 3 print (count) # Line 4 print (inputlnt) # Line 5
Which statement is equivalent to the statement found in Line 1?
- testStr = testStr[2:0]
- testStr = testStr[2:-1]
- testStr = testStr[2:-2]
- testStr = testStr - 2
- None of these
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 abcd what output is produced by Line 2?
- 0
- 1
- 2
- 3
- 4
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 Hi Mom what output is produced by Line 4?
- 0
- 1
- 2
- 3
- None of these
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?
- 0
- 1
- True
- False
- None of these