Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 6

92 bytes added, 11:35, 29 November 2017
LAB REVIEW
# What happens if you try and make a copy of an object?
# When does the __init__() method get executed?
# What is an attribute? How to do you create an attribute?
# What is a method?
# What is the difference between a method and a function?
# What is self used for in an object?
# What does it mean to instantiate an object?
# Import the Student class into ipython3, instantiate some objects, and try changing different attributes, and adding new attributes.
# Make a copy of lab6a.py called lab6practice.py, make the Student class accept another argument called program. When you create the new object: student = Student('name', '123456789', 'CTY'). Can you print the new students program out with student.program?
# Create a new method in lab6practice.py that checks to make sure the program is either "CTY" or "CNS", if it's not one of these, change the value to "unknown". Make sure the attribute is changed after your object is created.
[[Category:OPS435-Python]]
198
edits