Title here
Summary here
Based on the instructions and the provided Go code, I will translate the example into Python.
range
on lists provides both the index and value for each entry. Above we didn’t need the index, so we ignored it. Sometimes we actually want the indexes though.
range
on dictionaries iterates over key/value pairs.
range
can also iterate over just the keys of a dictionary.
range
on strings iterates over Unicode code points. The first value is the starting byte index of the rune
and the second the rune
itself.
To run the script, save it in a file (for example, range_over_built_in_types.py
) and execute it with Python.
Next example: Pointers.