Unpacking in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Unpacking in python

If I have a dictionary that contains the following items Dictionary = {'A': ['0','1','2','3','4','5','6','7','8']} How do I unpack it and print it as follow? A 0 1 2 3 4 5 6 7 8 I cannot find any attempts on this question

20th Dec 2019, 1:44 PM
UhhhhMarsha
2 Answers
+ 4
for i in range(0, 9, 3): print(*Dictionary['A'][i:i+3])
20th Dec 2019, 1:56 PM
HonFu
HonFu - avatar
+ 1
You're really good at this! I understand this method thank you so much!
20th Dec 2019, 2:10 PM
UhhhhMarsha