GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

Which of the following actions requires probable cause?

Which of the following actions requires probable cause?

Read Details

Which of the following best describes a “seizure” under the…

Which of the following best describes a “seizure” under the Fourth Amendment?

Read Details

Scenario:An officer sees a man loitering near a convenience…

Scenario:An officer sees a man loitering near a convenience store late at night. The man keeps glancing at the store and pacing back and forth. Believing the man is about to commit a robbery, the officer stops and frisks him, finding no weapons. The officer then searches the man’s backpack without consent and discovers stolen goods from a previous robbery. Did the officer have reasonable suspicion to stop the man? Why or why not? Was the search of the backpack constitutional? Why or why not?

Read Details

The border search exception allows warrantless searches of t…

The border search exception allows warrantless searches of travelers within 100 miles of a U.S. border.

Read Details

You work for a company that is having issues where many empl…

You work for a company that is having issues where many employees use passwords that are too weak. Your task is to help by writing a small script/app that reads a list of employee passwords from a file and checks how strong they are. The program will: read passwords from a text file (you can assume the input passwords.txt file is not erroneous) use a function to check if a password conforms to the official company rules write a report.txt back to disk with the password and whether or not it was OK Use only the features we’ve covered in this course: from the first 7 chapters (feel free to use type annotations on your function definitions if you wish); use exception handling for File IO if you’re going by the reading — or the with approach potentially seen in videos posted Functions to be coded Don’t try to do all these at once, I suggest getting the contents of the passwords.txt read in first, then print it in the main — then do the others only after you get that working. read_passwords Takes a file name string returns a list of string You’ll need to connect to the file name passed, read the list in line by line and return the list (each line holds one employee password). If you cannot load .txt files in the environment in which you are taking the test, make this function return a raw list containing the data under the notes section below. satisfies_policy Takes a password string, pword returns a true if pass has the following characteristics; false otherwise (if you can’t remember how to do one of these checks do the ones you know how to do)  pword must be of len at least 8 pword must contain exactly three $ or # characters pword must contain at least 1 number write_report Takes a output_file_name string a list of passwords returns nothing; The function should create a connection via open(..) to the output_file_name, iterate over each line of the file (each line will be a password), then you’ll call your satisfies_policy(..) function on that password to determine if it’s strong enough or not.  If the password is OK, you’ll write to the file the password followed by the string (OK) If the password is NOT OK (as determined by your satisfies_policy function), then you’ll write to the file the password followed by an “(X)” — meaning it violates company policy; see below for a full example  (don’t forget that you’ll need to put a newline after each line you write to the file using + “\n”)  Here’s an outline/pseudocode for the main: main:    call the read_passwords(“passwords.txt”) function           (save the list of passwords read_passwords returns into a variable)    call the write_report(“analysis.txt”, list-of-read-passwords saved from the above call) You should then see an “analysis.txt” file appear… it should look something like the following (X=bad password, OK=good pass) WeakPass (X)WeakPass1## (X)Strong$Pass1## (OK)short1## (X)NoDigits### (X)1234567$$$ (OK)abc123$$$ (OK)Pa$$$w0rd (OK)Cash###123 (OK)mix#of$chars#9 (OK)#####999 (OK)lettersONLY (X)###7$abc (OK) Notes This is just here in case your passwords.txt gets overwritten accidentally during development OR the environment you are taking the test in does not permit .txt files, you can make the readPasswords function just return these strings in a list: WeakPassWeakPass1##Strong$Pass1##short1##NoDigits###1234567$$$abc123$$$Pa$$$w0rdCash###123mix#of$chars#9#####999lettersONLY###7$abc

Read Details

Scenario: A driver is pulled over for speeding. The officer…

Scenario: A driver is pulled over for speeding. The officer notices an open bottle of alcohol in the passenger seat and asks the driver to take a breathalyzer test. The driver refuses. What legal doctrine allows officers to ultimately administer a breath or a blood test?

Read Details

 Which of the following is not an exception to the warrant r…

 Which of the following is not an exception to the warrant requirement?

Read Details

Which of the following is NOT a recognized warrant exception…

Which of the following is NOT a recognized warrant exception?

Read Details

A “nolo contendere” plea means the defendant admits guilt.

A “nolo contendere” plea means the defendant admits guilt.

Read Details

The Miranda warning must be given before every police intera…

The Miranda warning must be given before every police interaction with a suspect.

Read Details

Posts pagination

Newer posts 1 … 3,470 3,471 3,472 3,473 3,474 … 97,290 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top