Last active
November 23, 2021 02:18
-
-
Save MaodeColombia/3ef1151ee59bb3deaf219482b7b09c37 to your computer and use it in GitHub Desktop.
Combination from lowercase and digits
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
lowercase = 'abcdefghijklmnopqrstuvwxyz' | |
digits = '0123456789' | |
#List Comprehensions form | |
answer = [i+j+k+l for i in lowercase for j in lowercase for k in digits for l in digits] | |
#traditional form | |
answer2=[] | |
for a in lowercase: | |
for b in lowercase: | |
for c in digits: | |
for e in digits: | |
answer2.append(a+b+c+e) | |
print(correct_answer == answer) | |
print(correct_answer == answer2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment