Note that the % is kind of being deprecated in favor of the format method, your snippet will be replaced as follows:
sage: for i in range(5):