219x Filetype PDF File size 0.26 MB Source: www.annedawson.net
CSCI120 Introduction to Computer Science I using Python 3 Nov 9, 2018 Python3_Prog_OOP.odp c 2018 1 Object-Oriented Programming Go to code... Nov 9, 2018 Python3_Prog_OOP.odp c 2018 2 Before you can make an object in Python 3, you must first define the class... Nov 9, 2018 Python3_Prog_OOP.odp c 2018 3 Definition of the Person class: class Person(): ''' Instantiates a Person object with given name. ''' def __init__(self, first_name, last_name): ''' Initializes private instance variables _firstname and _lastname. ''' self._firstname = first_name self._lastname = last_name def __str__(self): ''' Returns the state of the Person object. ''' return self._firstname + " " + self._lastname Nov 9, 2018 Python3_Prog_OOP.odp c 2018 4
no reviews yet
Please Login to review.