Skip to content

Instantly share code, notes, and snippets.

@dandye
Created March 29, 2013 02:45
Show Gist options
  • Save dandye/5268392 to your computer and use it in GitHub Desktop.
Save dandye/5268392 to your computer and use it in GitHub Desktop.
Generator practice
def roman():
i = ""
for cnt in range(1,30):
if cnt != 1 and cnt % 10 == 0:
i = i[:-5] + "x"
elif cnt != 1 and cnt % 5 == 0:
i = i[:-4] + "v"
else:
i += "i"
print cnt, i
yield i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment