Assuming 1211 and "baba" is your pin and password.
Write two different functions that keeps looping until it gets the pin and password respectively.
i managed to write something using the itertools function but my tutor said not to use it and i should look for another way, i've only been coding for two weeks, so my understanding of python isn't wide and would really appreciate some advice. I'm really sorry about how messy my question is, this is my first time using this.
import itertools
import string
for guess in itertools.product(string.lowercase, repeat=6):
if checkguess(''.join(guess)):
print("Password is: {0}".format(''.join(guess)))
You can use for-loop
to try different combinations and find the pin or password, this is an example for the PIN:
pin = 1211
rng = int(len(str(pin)) * str(9))
for i in xrange(rng):
if i == pin:
print('pin is: {}'.format(i))
break
you can start with it and try to figure out how to do the rest :)