4.21 LAB: Detective Work (Python)
Using a list help Dr. Pepper investigate a crime. He usually asks 5 questions to each person he interviews:
The answers are always either "Yes" or "No".
Print the list after you record all the answers.
Your program must give a final verdict about the participation of that person in the crime. If there are 2 positive answers this person must be classified as "Suspect". For 3 or 4 positive answers the classification is "Accomplice", and for 5 positive answers the classification is "Killer". Otherwise, this person should be classified as "Innocent".
For example, if the input is:
No Yes Yes Yes No
The expected output is:
The recorded answers were ['No', 'Yes', 'Yes', 'Yes', 'No'] The verdict is: Accomplice.
Program Code to Copy
answers = []
##Taking answers and appending it to answers list
answers.append(input("Did you call the victim? "))
answers.append(input("Were you in the crime scene? "))
answers.append(input("Do you live close to the victim? "))
answers.append(input("Did you owe money to the victim? "))
answers.append(input("Have you ever worked with the victim? "))
print("\nThe recorded answers were ", answers)
print()
#Initiallising ansery count as zero
yesCount = 0
noCount = 0
#Traversing answer list to get positive and negative answer
count
for ans in answers :
if ans == 'Yes' :
yesCount = yesCount + 1
elif ans == 'No' :
noCount = noCount + 1
#Displaying Verdict
#If 3 or 4 Positive answers then Accomplice
if yesCount == 3 or yesCount == 4:
print("The verdict is: Accomplice.")
#If 5 Positive answers then Killer
elif yesCount == 5:
print("The verdict is: Killer.")
#else Innocent
else :
print("The verdict is: Innocent.")
Program Screenshot
Program Output
4.21 LAB: Detective Work (Python) Using a list help Dr. Pepper investigate a crime. He usually...
Using a list help Dr. Pepper investigate a crime. He usually asks 5 questions to each person he interviews: "Did you call the victim?" "Were you in the crime scene?" "Do you live close to the victim?" "Did you owe money to the victim?" "Have you ever worked with the victim?" The answers are always either "Yes" or "No". Print the list after you record all the answers. Your program must give a final verdict about the participation of that...
Article Summary I Read the article below and provide feedback by writing a 2 page summary. Please write in essay format (you may include the questions but the response should be in essay format) Must include the following information Title of the article Author(s) of the article Reference list (include the article itself and any other reference material such as another article that is cited in your summary). Use the reference list in the article to get information about another...
First, read the article on "The Delphi Method for Graduate Research." ------ Article is posted below Include each of the following in your answer (if applicable – explain in a paragraph) Research problem: what do you want to solve using Delphi? Sample: who will participate and why? (answer in 5 -10 sentences) Round one questionnaire: include 5 hypothetical questions you would like to ask Discuss: what are possible outcomes of the findings from your study? Hint: this is the conclusion....