Question

In: Computer Science

Coding in python question def generate_project_data_files(expected_grade_file_path, std_dev, num_projects, folder_path): """ For given student expected grades, generate...

Coding in python question

def generate_project_data_files(expected_grade_file_path,
                                std_dev, num_projects, folder_path):
    """
    For given student expected grades, generate the grades as
    described in generate_assignment_data given std_dev.

    For this method, you will generate multiple files for each project.
    For example, if num_projects = 4, then you should generate four files
    according to the following naming convention:
    "P_0.csv" ... "P_3.csv" .  The files should be written in the folder
    defined by folder_path.

    For example, given num_projects = 1 and folder_path="data", you should
    create one file of test grades in "data/P_0.csv"

    You should be making use of the generate_assignment_data method above!

    :param expected_grade_file_path: This is our file of student IDs and expected grades
    :param std_dev: Standard deviation used when sampling grades
    :param num_projects: Number of project files to generate
    :param folder_path: location of the output files.
    :return: Total number of grade samples written to all project files
    """

Solutions

Expert Solution

The required code & output is given below:

(Please note that the contents of the output files will depend on the generate assignment data function that is used in it. I have implemented the requirements of the function asked in this question):

CODE:

def generate_project_data_files(expected_grade_file_path,std_dev, num_projects, folder_path):
out_files_list = []
total_samples = 0 #initialize total samples to 0
for i in range(num_projects):
    out_files_list.append(f"P_{i}.csv")
    if not os.path.exists(folder_path): os.mkdir(folder_path)  # make directory
    out_file_path = folder_path + os.sep + f"P_{i}.csv" #generate file path for output by adding
    #call generate assignment data function with the generated out file path
    total_samples += generate_assignment_data(expected_grade_file_path,std_dev,out_file_path)[0]
return total_samples

CODE SCREENSHOT (For indentation reference):

OUTPUT:

Files in the required output folder specified:

(*Note: Please up-vote. If any doubt, please let me know in the comments)


Related Solutions

Python Coding Question: Find the minimum number of coins that make a given value.
Python Coding Question: Find the minimum number of coins that make a given value.
In python def lambda_2(filename): # Complete this function to read grades from `filename` and map the...
In python def lambda_2(filename): # Complete this function to read grades from `filename` and map the test average to letter # grades using map and lambda. File has student_name, test1_score, test2_score, # test3_score, test4_score, test5_score. This function must use a lambda # function and map() function. # The input to the map function should be # a list of lines. Ex. ['student1,73,74,75,76,75', ...]. Output is a list of strings in the format # studentname: Letter Grade -- 'student1: C' #...
This is a question about coding in python. I think that the question is asking me...
This is a question about coding in python. I think that the question is asking me to code the following: Implement the scalar product of 2 vectors in 2-space, using two tuple parameters (the function scalarProduct2). Write a docstring; then write some test function calls (can I pick any data for this? - the question gave these examples data examples: (1., 1.) dot (2,3) = (1.,1.) dot (2,0) = (1., 1.) dot (0,2) = (1., 1.,) dot (4,5) = );...
Python program please no def, main, functions Given a list of negative integers, write a Python...
Python program please no def, main, functions Given a list of negative integers, write a Python program to display each integer in the list that is evenly divisible by either 5 or 7. Also, print how many of those integers were found. Sample input/output: Enter a negative integer (0 or positive to end): 5 Number of integers evenly divisible by either 5 or 7: 0 Sample input/output: Enter a negative integer (0 or positive to end): -5 -5 is evenly...
Write a Python script that will collect 5 grades (float) from the student via input and...
Write a Python script that will collect 5 grades (float) from the student via input and obtain the average. requirements: a. Collect 5 floating grades from student b. Obtain the average of the grades
In Python: def _nodeAtIndex(self, index): """Returns the reference to the node at the given index; If...
In Python: def _nodeAtIndex(self, index): """Returns the reference to the node at the given index; If index is out of range, raise IndexError """ # PROBLEM 2 # You can assume that index is non-negative. # You need to traverse the list and stop at the required index. # YOUR CODE HERE (THIS IS WHAT I HAVE CURRENTLY WRITTEN BUT I"M STUCK AND DON"T KNOW WHAT TO DO) while current != None: # use a while-loop. plist.append(current._element) # process the...
IN PYTHON Given a string with duplicate characters in it. Write a program to generate a...
IN PYTHON Given a string with duplicate characters in it. Write a program to generate a list that only contains the duplicate characters. In other words, your new list should contain the characters which appear more than once. Suggested Approach Used two nested for loops. The first for loop iterates from 0 to range(len(input_str)). The second for loop iterates from first_loop_index + 1 to range(len(input_str)). The reason you want to start at first_loop_index + 1 in the nested inner loop...
Python Coding Question (Data Science) Hello I am having difficulty writing a code in python to...
Python Coding Question (Data Science) Hello I am having difficulty writing a code in python to do a specific task. I have two text files, Positive.txt and Practice_forhw1.txt. I want to write a script that will check if any words in Practice_forhw1.txt match any of the words in Positive.txt then the word would get replaced with a "+1" in the Practice_forhw1.txt and then print out the Practice_forhw1.txt.  (i.e if the word "happy" is in both Positive.txt and Practice_forhw1.txt then I want...
A student majoring in economics is looking for a job. Given his work experience and grades,...
A student majoring in economics is looking for a job. Given his work experience and grades, the probability of getting a job offer from a firm to which he applies is 50%. If he applies to 3 firms, what is the probability that he gets 2 job offers? (Find the nearest answer.) a. 24.3% b. 38.4% c. 43.2% d. 37.5% e. 44.1%
<Python coding question string practice> Can anyone please answer these python string questions?? 1. Write a...
<Python coding question string practice> Can anyone please answer these python string questions?? 1. Write a function called username that takes as parameters a person's first and last names and prints out his or her username formatted as the last name followed by an underscore and the first initial. For example, username("Martin", "freeman") should print the string "freeman_m". 2. Write a function called letters that takes as a parameter a string and prints out the characters of the string, one...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT