Created
March 29, 2013 02:45
-
-
Save dandye/5268392 to your computer and use it in GitHub Desktop.
Generator practice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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