Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- code
- code
- 100%
- 11
- link copied to clipboard., anyone with the link can edit.
- def generate_roster(name_file_path, roster_file_path, year=19):
- """
- Given a path to file with list of two names separated by space,
- a path to file for output roster, and year (default = 19),
-
- Generate a roster as a TAB separated file of :
- Last First ID
- on each line, where ID = first.last.year
-
- Ignore all lines that start with #
-
- :param name_file_path: relative path to file containing a list of names
- :param roster_file_path: relative path to file to hold the output roster
- :param year: year integer used to assign student IDs
- :return: number of students in roster
- """
-
-
- pass
- return -1
-
- def generate_expected_grades(roster_file_path, expected_grade_file_path,
- class_mean, class_std_dev ):
- """
- Given class roster (Last First ID), generate an
- file that randomly assigns an expected grade to each student
- according to a Gaussian (normal) distribution of defined by
- class_mean and class_std_deviation
-
- If the sample is higher than 100, re-sample.
- If the sample is lower than 0 or 5 standard deviations below mean,
- re-sample
-
- :param roster_file_path: file containing class roster
- :param expected_grade_file_path: output file containing ID and expected
- expected_grade_file_path of list of operations
- :param class_mean: ideal mean for the class samples
- :param class_std_deviation: ideal std_deviation for samples
- :return: calculated median, mean, std_dev for all samples
- """
- pass
- return None, None, None
-
-
- """
- Simple output if you run as a script
- """
- if __name__ == '__main__':
-
- import os
- num_students = generate_roster(os.path.join("data","short_names.txt"),
- os.path.join("data","short_roster.csv"))
-
- print("Generated ",num_student," IDs in roster")
- median, mean, std_dev = generate_expected_grades(os.path.join("data","short_roster.csv"),
- os.path.join("data","short_expected.csv"),
- 78.0, 10.0)
- print("Calculated median={} mean={} s.d.={}".format(median, mean, std_dev))
-
-
-
-
-
- def generate_letter_grades(expected_grade_file_path,
- gpa_file_path ):
- """
- Given file containing ID and expected grade separated by TAB characters
-
- Generate output file containing ID, expected grade (100 scale),
- comparable GPA (4.0 scale), and letter grade separated by tabs.
-
- For example, given
-
- captain.chris.19 78
-
- which for our purposes is a C+, the output file should contain
-
- captain.chris.19 78 2.3 C+
-
- :param expected_grade_file_path: output file containing ID and expected
- expected_grade_file_path of list of operations
- :param gpa_file_path: file containing ID, grade, gpa, and letter grade
- :return: None
- """
-
-
-
-
- """
- Simple output if you run as a script
- """
- if __name__ == '__main__':
-
- import os
- print("Generated file with comparable letter grades ... ")
- generate_letter_grades(os.path.join("data","short_expected.csv"),
- os.path.join("data","short_letters.csv"))
- Toggle screen reader support
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement