7from .iterator_class
import IteratorContainer_Class
20 print(
"Iterator Exercise")
26 print(
" Iterating over keys only:")
27 keyIterator = items.GetKeys()
28 item = keyIterator.Next()
30 print(
" {0}".format(item))
31 item = keyIterator.Next()
33 print(
" Iterating over values only:")
34 valueIterator = items.GetValues()
35 value = valueIterator.Next()
37 print(
" {0}".format(value))
38 value = valueIterator.Next()
40 print(
" Iterating over all items:")
41 itemIterator = items.GetItems()
42 key_value_pair = itemIterator.Next()
44 print(
" {0} = {1}".format(key_value_pair.Key, key_value_pair.Value))
45 key_value_pair = itemIterator.Next()
Represents a container that offers up two kinds of iterators for the hardcoded contents,...
def Iterator_Exercise()
Example of using the Iterator Pattern.