Question: Hi! So I'm really confused by my latest asignment question: In this assignment, you'll be exploring the database of Crime in Denver contained in this
Hi! So I'm really confused by my latest asignment question:
In this assignment, you'll be exploring the database of Crime in Denver contained in this zip file. The database contains two files
-
offence_codes.csv: Is a CSV file that contains offence codes and information about each code
- crime.csv: Is a CSV file containing information about 455872 crimes reported in Denver, mostly occurring in 2018.
Begin by downloading a4.py which contains skeleton code that opens and reads the CSV files line-by-line, with an obvious place for you to add your code. Which I've done with no problem. Issue is I don't know what he means by the question: Write a function code_to_names(code) that takes an int crime code and returns a list of strings where each string contains the code extension and the full name of the crime.
This is just the first of many questions. Honestly I'd just really appreciate it if someone could explain to me where to start. What should I be trying to do here?
import csv # Question 1 def code_to_names (code) names [ with open ('offense codes.csv') as csv file: reader = csv. reader (csvfile, delimiter= ',') next (reader) # skip the first row for row in reader - pass # Your code goes here return names
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
