The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
ALL I NEED IS FOR YOU TO CORRECT MY MISTAKE.
MY PROGRAM ONLY WORKS FOR CLASS1.TXT
Assignment #9
The parts below describe a single large program so you will only need to turn in one file for this assignment. remember to compress it into a zip and upload to NYU classes. Also, the programs below utilize a series of external data files -Â click here to download these files as a ZIP archive.
Part 1
You just finished administering the final exam for all of the students in the "Introduction to Computer Programming" classes this semester. The exam was a 25 question multiple choice exam, and it is your job to grade the exams. You have all of the scores stored in a series of text files (click here to download these files).
To begin, download the data files and store them in a folder on your computer. Then create a new Python program inside of this folder called "YourName_Assignment09.py". Make sure your source code file is inside of the same folder as the data files you just downloaded!
Next, write a program that lets the user type in the name of a file. Attempt to open the supplied file for read access. If the file exists you can print out a confirmation message. If the file doesn't exist you should tell the user that the file cannot be found. Hint: use a try/except block to do this (don't just use a series of "if" statements - we want this program to be as "generic" as possible). You will not get credit for this part of the program if you write something like the following to identify valid data files:
filename = input("Enter a filename: ")
if filename == "class1":
# open class1.txt
elif filename == "class2":
# open class2.txt
else:
print ("Sorry, I can't find this filename")
Here's a sample running of the program:
Enter a class file to grade (i.e. class1 for class1.txt): foobar File cannot be found. Enter a class file to grade (i.e. class1 for class1.txt): class1 Successfully opened class1.txt
Â
Part 2
Next, you are going to write a program to grade the exams for a given section. The exam was a 25 question multiple choice exam. Here are the answers to the exam:
answerkey = "B,A,D,D,C,B,D,A,C,C,D,B,A,B,A,C,B,D,A,C,A,A,B,D,D"
Each data file contains a series of student responses in the following format:
N12345678,B,A,D,D,C,B,D,A,C,C,D,B,A,B,A,C,B,D,A,C,A,A,B,D,D
or
N12345678,B,,D,,C,B,,A,C,C,,B,A,B,A,,,,A,C,A,A,B,D,
The first number is the student’s ID number. The following 25 letters are the student responses to the exam. If there is no letter following a comma, this means the student skipped answering the question.
Note that some lines of data may be corrupted! For example, this line of data does not have enough answers:
N12345678,B,A,D,D,C,B
... and this line of data has too many answers:
N12345678,B,A,D,D,C,B,D,A,C,C,D,B,A,B,A,C,B,D,A,C,A,A,B,D,D,A,B,C,D,E
If you encounter a line of data that is un-usable you should make a note of it and not use the line in your calculations. Report to the user at the end of the program how many unusable lines of data you found.
Your program should open up the file specified by the user and read in the data. It should then compute the following:
Here's a sample running of your program:
Enter a class file to grade (i.e. class1 for class1.txt): class1 Successfully opened class1.txt Grade Summary: Total students: 20 Unusable lines in the file: 0 Highest score: 91 Lowest score: 59 Mean score: 75.60
Hints: Use the "split" method to split apart the data from the file. You may need to use this method a few times along with a loop or two. Hint: think about the order in which you need to split your items. For example, your file is organized so that one student's record occupies an entire line in the file. Splitting first on the line break will isolate each student's data. Then you will need to further split each item based on the separator character to pull out the responses for each student.
Hint: once you've scored the students you should use a list to store indivdual student scores - you can then compute statistics after you've examined every student in the file.
Solutions:Â you can view the expected solutions for all of the data files by clicking here. Note that this solution file also includes the "median", "mode" and "range" - you will be computing these values in the next part of the assignment.
Â
Part 3
Next, have your program compute the following based on each data file:
unique = [100,90,80] seen = [1,5,3]Hint: use the "in" operator, the "append" method and the max function to help you solve this problem!
Here's a sample running of your program for class1:
Enter a class file to grade (i.e. class1 for class1.txt): class1 Successfully opened class1.txt Grade Summary: Total students: 20 Highest score: 91 Lowest score: 59 Mean score: 75.60 Median score: 73.0 Mode: 73 Range: 32
Â
Part 4
Finally, have your program generate a "results" file that contains the detailed results for each student in your class. Each line of this file should contain the student’s ID number, a comma, and then their grade truncated to 2 decimal points. You should name this file based on the original filename supplied -- for example, if the user wants to analyze "class1.txt" you should store the results in a file named "class1_grades.txt"
Here's a sample of what "class1_grades.txt" should look like. You can download all result files by clicking here.
N00000001,59.00 N00000002,70.00 N00000003,84.00 N00000004,73.00 N00000005,83.00 N00000006,66.00 N00000007,88.00 N00000008,67.00 N00000009,86.00 N00000010,73.00 N00000011,86.00 N00000012,73.00 N00000013,73.00 N00000014,78.00 N00000015,72.00 N00000016,91.00 N00000017,66.00 N00000018,78.00 N00000019,78.00 N00000020,68.00
Â
Part 5 (Extra Credit)
As you can see, some students didn't do very well on their exams. Add a feature to your program that lets the user "curve" the test scores so that they are adjusted in such a way that the mean score is increased to a desired level. Only accept positive curve values. Then re-generate the "class_grades.txt" file to include this information.
You can simply add the curve value to each student's score (i.e. if the user is curving the exam from a 75 to an 80 you would add +5 to each student score).
Here's a sample running of your program:
Enter a class file to grade (i.e. class1 for class1.txt): class1 Successfully opened class1.txt Grade Summary: Total students: 20 Unusable lines in the file: 0 Highest score: 91 Lowest score: 59 Mean score: 75.60 Median score: 73.0 Mode: 73 Range: 32 Would you like to curve the exam? 'y' or 'n': y Enter a desired mean (i.e. 75.0 to raise the mean score to 75.0): -5 Invalid curve, try again. Enter a desired mean (i.e. 75.0 to raise the mean score to 75.0): 80.0 Done! Check your grade file!
And here's a copy of the grade file that should be generated for class1 with a curved score of 80.0 - note the 3rd column contains the curved score (the 1st and 2nd columns are the same):
N00000001,59,64 N00000002,70,75 N00000003,84,89 N00000004,73,78 N00000005,83,88 N00000006,66,71 N00000007,88,93 N00000008,67,72 N00000009,86,91 N00000010,73,78 N00000011,86,91 N00000012,73,78 N00000013,73,78 N00000014,78,83 N00000015,72,77 N00000016,91,96 N00000017,66,71 N00000018,78,83 N00000019,78,83 N00000020,68,73Attachments:
-----------