English

Predict the output of the following Python code: wildlife_sanctuary = ["Kaziranga", "Ranthambhore", "Jim Corbett", "Sundarbans", "Periyar", "Gir", "Bandipur"] output = [ ] - Computer Science (Python)

Advertisements
Advertisements

Question

Predict the output of the following Python code:

wildlife_sanctuary = ["Kaziranga", "Ranthambhore", "Jim Corbett", "Sundarbans",
"Periyar", "Gir", "Bandipur"]
output = [ ]
for sanctuary in wildlife_sanctuary:
   if sanctuary[−1] in 'aeiou':
      output.append(sanctuary[0].upper())
print(output)
Very Short Answer
Advertisements

Solution

['K', 'R']

shaalaa.com
  Is there an error in this question or solution?
2025-2026 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×