Predict the output of the following : (2)
squares={}
for x in range(11):
if x%2==1:
squares[x]=x*x
print(squares)
Answers
Answered by
4
Output:
{1: 1, 3: 9, 5: 25, 7: 49, 9: 81}
Explanation:
It saves the odd numbers from 0-10 as the key and their squares as the values in the squares dictionary.
Similar questions