Help understanding this Python for loop!


Just a quick Python question! I'm somewhat new and would like help conceptualizing this algo please.

How is Python interpreting this algorithm step by step?

Shouldn't the printed output be in the order of :
Once: 1
Twice: 2
Once: 2
Twice: 4


no, if you want order you should lists. You have no influence on the order of a dictionary. Unless you print them with the help of sort()


Oh yeah, I remember that now. I guess it doesn't matter either because the importance of a dictionary is to call a value using a key. Thank you!