Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+33 votes

Does anyone understand what "Mr.Hannaldous" is trying to do? In other words, for problem 2 on the lab, does anyone understand what the code is trying to do? I don't even know if the initial results from the original code is correct...
Thank you so much.

asked in CSC285_Fall2018 by (1 point)

1 Answer

+15 votes

You may assume that the original how_bad method does produce correct results.

Your goal is to refactor it: to make the code more elegant without changing the external behavior.

In terms of what Hannaldous' code does, a hint is that it has something to do with evaluating passwords.

answered by (508 points)

So the good password should only be made of letters?


at first I thought the same as you too, April.
but his howbad method actually count how many passwords that are considered as "bad", which are either made of all letters or less then the length "n" in the parameter.