Aug-30-2022, 02:23 PM
There is not need need(a bad way) to make a varibale
Just loop over the dictionary like this.
i
at start an use it at index later.Just loop over the dictionary like this.
quiz = { 'What is the fastest land animal?': 'Cheetah', 'What is Pi?': 3.14 } for key, value in quiz.items(): #print(key, value) print(f"Question {key} answer is: {value}")
Output:Question What is the fastest land animal? answer is: Cheetah
Question What is Pi? answer is: 3.14