From a23719462db7a9d97c60535a84de2b9df31c8e04 Mon Sep 17 00:00:00 2001 From: gsingh58 <gurmail-singh@wisc.edu> Date: Fri, 3 Mar 2023 00:12:16 -0600 Subject: [PATCH] Lec16 update --- .../16_List_Practice/project.py | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 s23/Gurmail_lecture_notes/16_List_Practice/project.py diff --git a/s23/Gurmail_lecture_notes/16_List_Practice/project.py b/s23/Gurmail_lecture_notes/16_List_Practice/project.py deleted file mode 100644 index e2c3096..0000000 --- a/s23/Gurmail_lecture_notes/16_List_Practice/project.py +++ /dev/null @@ -1,75 +0,0 @@ -__student__ = [] - - -def __init__(): - import csv - """This function will read in the csv_file and store it in a list of dictionaries""" - __student__.clear() - with open('cs220_survey_data.csv', mode='r', encoding='utf-8') as csv_file: - csv_reader = csv.DictReader(csv_file) - for row in csv_reader: - __student__.append(row) - - -def count(): - """This function will return the number of records in the dataset""" - return len(__student__) - - -def get_lecture(idx): - """get_lecture(idx) returns the lecture of the student in row idx""" - return __student__[int(idx)]['Lecture'] - - -def get_section(idx): - """get_lecture(idx) returns the section of the student in row idx""" - return __student__[int(idx)]['section'] - - -def get_age(idx): - """get_age(idx) returns the age of the student in row idx""" - return __student__[int(idx)]['Age'] - - -def get_primary_major(idx): - """get_primary_major(idx) returns the primary major of the student in row idx""" - return __student__[int(idx)]['Primary major'] - - -def get_other_majors(idx): - """get_other_majors(idx) returns the secondary major of the student in row idx""" - return __student__[int(idx)]['Other majors'] - - -def get_zip_code(idx): - """get_zip_code(idx) returns the residential zip code of the student in row idx""" - return __student__[int(idx)]['Zip Code'] - - -def get_pizza_topping(idx): - """get_pizza_topping(idx) returns the preferred pizza toppings of the student in row idx""" - return __student__[int(idx)]['Pizza topping'] - -def get_pet_owner(idx): - """get_pet_owner(idx) returns whether student in row idx is a pet owner""" - return __student__[int(idx)]['Pet owner'] - -def get_runner(idx): - """get_runner(idx) returns whether student in row idx is a runner""" - return __student__[int(idx)]['Runner'] - -def get_sleep_habit(idx): - """get_sleep_habit(idx) returns the sleep habit of the student in row idx""" - return __student__[int(idx)]['Sleep habit'] - -def get_procrastinator(idx): - """get_procrastinator(idx) returns whether student in row idx is a procrastinator""" - return __student__[int(idx)]['Procrastinator'] - - -def get_song(idx): - """get_procrastinator(idx) returns the student in row idx favorite song""" - return __student__[int(idx)]['Song'] - - -__init__() -- GitLab