Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Modify the following Python code so that instead of returning the time in second

ID: 3876982 • Letter: M

Question

Modify the following Python code so that instead of returning the time in seconds, it returns the time in minutes.

def numberPossiblePasswords(numDigits, numPossiblePerDigit):

    numPasswords = numPossiblePerDigit**numDigits

    return numPasswords

   

def maxSecondsToCrack(numPossiblePasswords, secPerAttempt):

    time = numPossiblePasswords*secPerAttempt

    return time

nd = int(input("How many digits long is the passcode? "))       

nc = int(input("How many possible characters are there per digit? "))

secondsPerAttempt = .08

npp = numberPossiblePasswords(nd, nc)

totalSeconds = maxSecondsToCrack(npp, secondsPerAttempt)

print("It will take you " + str(totalSeconds) + " seconds maximum to crack the password.”)

Modify the code so that instead of returning the time in seconds, it returns the time in minutes.

Explanation / Answer

def numberPossiblePasswords(numDigits, numPossiblePerDigit):
numPasswords = numPossiblePerDigit**numDigits
return numPasswords

def maxSecondsToCrack(numPossiblePasswords, secPerAttempt):
time = (numPossiblePasswords*secPerAttempt)/60
return time
nd = int(input("How many digits long is the passcode? "))   
nc = int(input("How many possible characters are there per digit? "))
secondsPerAttempt = .08
npp = numberPossiblePasswords(nd, nc)
totalSeconds = maxSecondsToCrack(npp, secondsPerAttempt)
print("It will take you " + str(totalSeconds) + " seconds maximum to crack the password.”)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote