Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #function to return true if adjacent duplicate numbers
- def findDupes(num1):
- value = False
- array1 = list(str(num1))
- for x in range(0,5):
- if(array1[x]==array1[x+1]):
- value = True
- break
- return value
- #function to return true if non-decreasing adjacent numbers
- def findDown(num1):
- value = True
- array1 = list(str(num1))
- for x in range(0,5):
- if(array1[x]>array1[x+1]):
- value = False
- break
- return value
- count = 0;
- #loop to run through the range
- for i in range(183564,657475):
- if(findDupes(i) and findDown(i)):
- count += 1
- print("The number of possible correct passwords is: " + str(count))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement