Last active
December 28, 2015 18:39
-
-
Save st98/7544915 to your computer and use it in GitHub Desktop.
変数名を生成する関数。英小文字オンリーです。
This file contains 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
from random import randint | |
def gen_variable_name(a): | |
while True: | |
yield ''.join([ | |
chr(0x61 + randint(0, 25)) | |
for _ in range(a) | |
]) | |
if __name__ == '__main__': | |
a = gen_variable_name(int(input())) | |
for _ in range(10): | |
print(next(a)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment