why is this code is not showing the time to it take to finish the process 😒 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why is this code is not showing the time to it take to finish the process 😒

from urllib.request import urlopen, hashlib import time start_time = time.time() sha1hash = input("Please input the hash to crack.\n>") with open('password_file.txt') as f: LIST_OF_COMMON_PASSWORDS = f.read() for guess in LIST_OF_COMMON_PASSWORDS.split('\n'): hashedGuess = hashlib.sha1(bytes(guess, 'utf-8')).hexdigest() if hashedGuess == sha1hash: print("The password is ", str(guess)) quit() elif hashedGuess != sha1hash: print("Password guess ",str(guess)," does not match, trying next...") print("Password not in database, we'll get them next time.") end_time = time.time() print("Time taken: ", end_time - start_time)

28th Jan 2023, 11:00 PM
ANAS IL CAPO
ANAS IL CAPO - avatar
4 Answers
+ 4
ANAS IL CAPO It would be easier for people to help you if you give a short description of your code and the expected outputs. Assuming the code runs without errors on your pycharm, my guess would be that the `quit()` statement is causing the program to exit before reaching the end and printing the time taken. Try replacing quit() with `break` to exit the loop but not the program itself.
29th Jan 2023, 1:41 AM
Mozzy
Mozzy - avatar
+ 1
If you mean on Sololearn, it is because it cannot find the file, so it doesn't run correctly here.
29th Jan 2023, 12:09 AM
Lochard
Lochard - avatar
0
no in pycharm
29th Jan 2023, 12:20 AM
ANAS IL CAPO
ANAS IL CAPO - avatar
0
How I can create my own website
30th Jan 2023, 3:07 PM
Gracious laston Eluwin
Gracious laston Eluwin - avatar