KnowledgeBoat Logo

Computer Science

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

theStr = " This is a test "         
inputStr = input(" Enter integer: ")
inputlnt = int(inputStr)            
testStr = theStr
while inputlnt >= 0 :               
    testStr = testStr[1:-1]        
    inputlnt = inputlnt - 1
testBool = 't' in testStr
print (theStr)             # Line 1 
print (testStr)            # Line 2 
print (inputlnt)           # Line 3 
print (testBool)           # Line 4 

Given the input integer 3, what output is produced by Line 1?

  1. This is a test
  2. This is a
  3. is a test
  4. is a
  5. None of these

Python String Manipulation

5 Likes

Answer

Option 1 — This is a test

Answered By

4 Likes


Related Questions