Open main menu

CDOT Wiki β

Changes

OPS445 Online Lab6

16 bytes added, 15:48, 20 January 2023
wget addr switched to github
# Add new courses for student1
student1.addGrade('uli101', 4.0)
student1.addGrade('ops235ops245', 3.5)
student1.addGrade('ops445', 3.0)
=== Create a Python Script Demonstrating Classes ===
:# The following python script is broken. It has two major problems to fix and one new feature to add: <br />'''first problem''' is providing the student number as an integer causes an error(TypeError) when displayStudent() is run, <br />'''second problem''' is in displayGPA() may divide by zero(ZeroDivisionError) if no courses are added to the dictionary or the grades added to the dictionary are 0.0 floats. <br />'''Finally''', you will add a new method to this class that prints out a formatted list of all courses the student has takenpassed.
:#Create the '''~/ops445/lab6/lab6a.py''' script.
:#Use the following as a template(warning this is NOT the same as student.py):<source lang="python">
student1 = Student('John', '013454900')
student1.addGrade('uli101', 1.0)
student1.addGrade('ops235ops245', 2.0)
student1.addGrade('ops445', 3.0)
Student Number: 013454900
GPA of student John is 2.0
['ops445', 'ops235ops245', 'uli101']
Student Name: Jessica
Student Number: 123456
cd ~/ops445/lab6/
pwd #confirm that you are in the right directory
ls CheckLab6.py || wget 'https://ictgithub.senecacollege.cacom/~eric.brauersenecaops445/ops445lab6-template/labsblob/LabCheckScriptsmaster/CheckLab6.py?raw=true' -O CheckLab6.py
python3 ./CheckLab6.py -f -v lab6a
</source>