Dec-04-2017, 03:15 PM
I need to convert user string input to a number. My statement on line 7 isn't working:
import itertools import sys alphaNum = 'abc' password = 'cab' guessLength = input("How many characters would you like to guess up to: ") int(guessLength) for x in range(0, guessLength+1): guessList = [''.join(i) for i in itertools.product(alphaNum, repeat = x)] for guess in guessList: if (password == guess): print("the password is " + password) sys.exit() print(guess)
Error:Traceback (most recent call last):
File "E:/Python/Python36-32/SamsPrograms/FinalPasswordGuesser.py", line 10, in <module>
for x in range(0, guessLength+1):
TypeError: Can't convert 'int' object to str implicitly
What do I need to do?