हिंदी

Identify the correct output of the following code snippet: game="olympic2024" print(game.index("C")) - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

Identify the correct output of the following code snippet:

game="olympic2024"
print(game.index("C"))

विकल्प

  • 0

  • 6

  • −1

  • ValueError

MCQ
Advertisements

उत्तर

ValueError

Explanation:

The character ‘C’ does not exist in the string "olympic2024". Since the index() method raises an error when the specified character is not found; a ValueError is returned.

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2024-2025 (March) Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×