Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. possible = 0
  2. for pas in range(138241, 674034 + 1):
  3.  
  4.     pas = str(pas)
  5.     rule1 = False
  6.     for x in range(0, 5):
  7.         if pas[x] == pas[x + 1]:
  8.             if x == 0 and pas[x + 2] != pas[x]:
  9.                 rule1 = True
  10.                 break
  11.             if x > 0 and x < 4 and pas[x + 2] != pas[x] and pas[x - 1] != pas[x]:
  12.                 rule1 = True
  13.                 break
  14.             if x == 4 and pas[x - 1] != pas[x]:
  15.                 rule1 = True
  16.                 break
  17.     if rule1 == False:
  18.         # print("breaks rule 1")
  19.         continue
  20.  
  21.     rule2 = True
  22.     for x in range(0, 5):
  23.         if pas[x] <= pas[x + 1]:
  24.             continue
  25.         else:
  26.             rule2 = False
  27.             break
  28.     if rule2 == False:
  29.         # print("breaks rule 2")
  30.         continue
  31.  
  32.     # print(pas)
  33.     # print("good")
  34.     # print("-")
  35.     possible += 1
  36.  
  37. print(possible)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement