I would like to know how I could return every output of the list crack into a Text file
For example if I get:
abandon able ability
I would to have this (what I call output of crack) output in a text file. And so on
def generate(arr, i, s, len):
# base case
if (i == 0): # when len has
# been reached
# print it out
print(s)
return
# iterate through the array
for j in range(0, len):
# Create new string with
# next character Call
# generate again until
# string has reached its len
appended = s + arr[j]
generate(arr, i - 1, appended, len)
return
# function to generate
# all possible passwords
def crack(arr, len):
# call for all required lengths
for i in range(3 , 5):
generate(arr, i, "", len)
# Driver Code
arr = ["abandon ","ability ","able ","about ","above ","absent "]
len = len(arr)
crack(arr, len)