ЁЯУв Too many exams? DonтАЩt know which one suits you best? Book Your Free Expert ЁЯСЙ call Now!

  • google app store apple app store
  • тЬЦ

      Question

      What is the outpur of the following part of python

      program? s="india" 1=0 for x in s: if(X!="i"): 1=1+1 else: pass print(1)
      A 1 Correct Answer Incorrect Answer
      B 5 Correct Answer Incorrect Answer
      C 6 Correct Answer Incorrect Answer
      D 3 Correct Answer Incorrect Answer

      Solution

      • String "india" тЖТ characters = i, n, d, i, a
      • Condition if(x != "i") counts all characters except "i" .
      • "n" , "d" , "a" satisfy condition тЖТ count = 3.
      • Output = 3 .
      • Why Others are Wrong:
        • 1: Wrong, only counts one.
        • 5: Would mean all counted.
        • 6: Impossible (string length is 5).

      Practice Next
      More IT Operating System Questions

      Relevant for Exams:

      ask-question