Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs220-lecture-material
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
YE MOU
cs220-lecture-material
Commits
a2371946
Commit
a2371946
authored
2 years ago
by
gsingh58
Browse files
Options
Downloads
Patches
Plain Diff
Lec16 update
parent
764177ac
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
s23/Gurmail_lecture_notes/16_List_Practice/project.py
+0
-75
0 additions, 75 deletions
s23/Gurmail_lecture_notes/16_List_Practice/project.py
with
0 additions
and
75 deletions
s23/Gurmail_lecture_notes/16_List_Practice/project.py
deleted
100644 → 0
+
0
−
75
View file @
764177ac
__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__
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment