Nội dung text CSC/2022/223 LAB REPORT FOR 5 & 6
NAME: UVIETOBORE TREASURE OKEHOGHENE MATRIC NUMBER: CSC/2022/223 DEPARTMENT: COMPUTER SCIENCE WITH ECONOMICS LAB 5 REPORT Question: Write a program that reads a file of numbers and removes all outliers beyond 3 standard deviations. a. What was the name of the Python IDE you used? Cursor IDE. b. The output of the program: Removed 3 outliers c. Algorithm 1. Read all numbers from the file and store them in a list. 2. Convert the list to a NumPy array of floats. 3. Calculate the mean and standard deviation. 4. Filter values within ±3 standard deviations. 5. Write the filtered values to an output file. 6. Print the number of outliers removed.
e. Reflection ● What interests me most: I enjoyed how the NumPy library simplifies statistical operations. ● Time spent: Writing the full code and testing took about 40 minutes. ● Challenging part: Handling file input/output and ensuring all values were valid floats. ● Experience: It ran smoothly after correcting file paths and checking for empty lines. ● Impression: The structure using classes helped keep it organised and scalable. f. Overall time to solve: 40 minutes LAB 6 REPORT Question: Create a function to calculate the mean absolute deviation of a list of numbers. a. What was the name of the Python IDE you used? Cursor IDE. b. The output of the program: Mean Absolute Deviation: 2.0