Aug-30-2022, 01:02 PM
(This post was last modified: Aug-30-2022, 02:04 PM by Yoriz.
Edit Reason: Added code tags
)
given the code snippet:
i = 0 for key, value in quiz.items(): i += 1 print(f"Question {str(i)} : {key['question']}")Line 5 fails with the error code,
Error:TypeError: string indices must be integers
The variable named 'i' is clearly an integer. Can someone explain why it fails with this error?