Single Choice
Not Set
Q Write the output of the following:
a=(23,34,65,20,5)
s=0
for i in a:
if i%2==0:
s=s+a[i]
print(s)
ID: #3669
Python Tuple MCQ
248 views
Question Info
#3669Q ID
Not SetDifficulty
Python Tuple MCQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
--------------------------------------------------------------------------- IndexError Traceback (most recent call last) Input In [6], in| () 3 for i in a: 4 if i%2==0: ----> 5 s=s+a[i] 6 print(s) IndexError: tuple index out of range |
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic