Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 6

14 bytes added, 23:17, 25 February 2018
Create a Python Script Demonstrating Classes
::*The script should contain no errors
:::'''Sample Run 1:'''<source lang="python">
python3 ./lab6a.py
Student Name: John
Student Number: 013454900
['cpp244', 'ipc144']
</source>
:::'''Sample Run 2 (with import into ipython3):'''<source lang="python">
from lab6a import Student
student1.displayStudent()
# Will print: 'Student Name: Jack\nStudent Number: 931686102'
student1.displayGPA()
# Will print: 'GPA of student Jack is 1.0'
student1.displayCourses()
# Will print: ['ops535']
student2 = Student('Jen', 987654321)
student2.displayGPA()
# Will print: 'GPA of student Jen is 0.0'
student2.displayCourses()
# Will print: []
</source>
::3. Exit the ipython3 shell, download Download the checking script and check your work. Enter the following commands from the bash shell.<source lang="bash">
cd ~/ops435/lab6/
pwd #confirm that you are in the right directory
python3 ./CheckLab6.py -f -v lab6a
</source>
::4. Before proceeding, make certain that you identify any and all errors in lab6a.py. When the checking script tells you everything is OK before proceeding - proceed to the next step.
<br><br>