Password hack find password to right a password

Problem description:

from random import*
your_pass= input('Enter your password')
password = ['a, b, c, d, e, f, g, h,I, k, j, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1,2,3,4,5,6,7,8,9,0,@, #, ₹, _, &, -, +, (,), /, *, ", :, ;,!,?,']
guess = ""
while (guess!=your_pass):
  guess = ""
for letter in range (len(your_pass)):
  guess_letter = password[randint(0, 25)]
  guess = str(guess_letter) + str(guess)
  print(guess)
  print('your password is',guess)

Expected behavior:

Actual behavior:

Steps to reproduce:

Bug appears at this link:

Browser/OS/Device:

Um your main problem is that you have spacing all wrong, your for loop needs to be indented under your while loop.
My solution:

import random # it's best practice not to import everything
import string

user_pass = input("Enter Password: ")

guess = ""

while guess != user_pass: # this is python we don't put parenthesis around conditions
	guess = "".join([random.choice(string.printable) for i in range(len(user_pass))])


print(f"I guessed your password as: {guess}")
print(f"Your password is: {user_pass}")
2 Likes

keep in mind that it’s making totally random guesses so it is probably going to take forever

3 Likes