Nov-13-2017, 05:10 AM
(Nov-13-2017, 04:01 AM)metulburr Wrote: one is guest and the other is guess
But I have a new problem:
#!/usr/bin/env python3 #PasswordGuesser.py AlphaNum = "abc" passwordThatNeedsToBeGuessed = "cab" guessMatches = False guess = "" guessList = list(guess)#make a list version of guess, so we can change the chars guess = ''.join(guessList)#convert to a string, so we can print guess as a string guessLength = len(guess) ##def iterateAlphaNum(): ## i = 0 ## while i < len(AlphaNum): ## guess[0] == AlphaNum[i] ## i += 1 guessLength = 1 #start with a guess length of just one char char1 = 0 for char1 in AlphaNum: guessList[0] = AlphaNum[char1] char1 += 1 print(guess)
Error:Traceback (most recent call last):
File "I:\Python\Python36-32\SamsPrograms\PasswordGuesser.py", line 21, in <module>
guessList[0] = AlphaNum[char1]
TypeError: string indices must be integers
I also tried putting the int keyword before char1 on line 19, but an error said that was invalid syntax. This is a problem, because it's vital for this program to be able to dynamically reference chars from AlphaNum.