Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. import string
  2.  
  3. start_year = 1950
  4. stop_year = 2020
  5. birthday = []
  6. for y in range(start_year, stop_year):
  7. for m in range(1, 13):
  8. for d in range(1, 32):
  9. s1 = str(y)
  10. s2 = str(m)
  11. s3 = str(d)
  12. if len(s2) < 2:
  13. s2 = "0" + s2
  14. if len(s3) < 2:
  15. s3 = "0" + s3
  16. birthday.append(s1 + s2 + s3)
  17.  
  18. first_row = "qwertyuiop"
  19. second_row = "asdfghjkl"
  20. third_row = "zxcvbnm"
  21. common_arrangement = []
  22. for l in range(4, 8):
  23. for s in [first_row, second_row, third_row]:
  24. for i in range(0, len(s) - l + 1):
  25. common_arrangement.append(s[i:i + l])
  26.  
  27.  
  28. def f0(f):
  29. for i in common_arrangement:
  30. temp = []
  31. for j in birthday:
  32. temp.append(i + j + "\n")
  33. temp.append(j + i + "\n")
  34. f.writelines(temp)
  35.  
  36.  
  37. def f1(f):
  38. for i in string.ascii_letters:
  39. temp = []
  40. for j in birthday:
  41. temp.append(i + j + "\n")
  42. temp.append(j + i + "\n")
  43. f.writelines(temp)
  44.  
  45.  
  46. def f2(f):
  47. for i in string.ascii_letters:
  48. for k in string.ascii_letters:
  49. temp = []
  50. t = i + k
  51. for j in birthday:
  52. temp.append(t + j + "\n")
  53. temp.append(j + t + "\n")
  54. f.writelines(temp)
  55.  
  56.  
  57. def f3(f):
  58. for i in string.ascii_lowercase:
  59. for j in string.ascii_lowercase:
  60. for k in string.ascii_lowercase:
  61. temp = []
  62. t = i + j + k
  63. for b in birthday:
  64. temp.append(t + b + "\n")
  65. f.writelines(temp)
  66.  
  67.  
  68. def f4(f):
  69. for i in string.ascii_uppercase:
  70. for j in string.ascii_uppercase:
  71. for k in string.ascii_uppercase:
  72. temp = []
  73. t = i + j + k
  74. for b in birthday:
  75. temp.append(t + b + "\n")
  76. f.writelines(temp)
  77.  
  78.  
  79. def f5(f):
  80. for i in string.ascii_lowercase:
  81. for j in string.ascii_lowercase:
  82. for k in string.ascii_lowercase:
  83. temp = []
  84. t = i + j + k
  85. for b in birthday:
  86. temp.append(b + t + "\n")
  87. f.writelines(temp)
  88.  
  89.  
  90. def f6(f):
  91. for i in string.ascii_uppercase:
  92. for j in string.ascii_uppercase:
  93. for k in string.ascii_uppercase:
  94. temp = []
  95. t = i + j + k
  96. for b in birthday:
  97. temp.append(b + t + "\n")
  98. f.writelines(temp)
  99.  
  100.  
  101. def main():
  102. choice = input("""0. common arrangement + birthday and birthday + common arrangement
  103. 1. one letter + birthday and birthday + one letter (10 years 3.7MB)
  104. 2. two letters + birthday and birthday + two letters (10 years 214.2MB)
  105. 3. three lowercase letters + birthday (10 years 759.3MB)
  106. 4. three capital letters + birthday
  107. 5. birthday + three lowercase letters
  108. 6. birthday + three capital letters
  109. """
  110. )
  111. choice = int(choice)
  112.  
  113. f = open("dict.txt", 'w+')
  114. try:
  115. if choice == 0:
  116. f0(f)
  117. elif choice == 1:
  118. f1(f)
  119. elif choice == 2:
  120. f2(f)
  121. elif choice == 3:
  122. f3(f)
  123. elif choice == 4:
  124. f4(f)
  125. elif choice == 5:
  126. f5(f)
  127. elif choice == 6:
  128. f6(f)
  129. finally:
  130. f.close()
  131.  
  132.  
  133. if __name__ == '__main__':
  134. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement