Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 7 - Objects and Classes - Section 7.2 - Defining Classes for Objects - Check Point - MyProgrammingLab - Page 221: 7.10

Answer

(a) The initializer name is incorrect for the class A and the variable is a local variable but it should be class variable. (b) The setRadius method does not have self as a parameter and in the initializer the variable radius is defined as a local variable not as a class variable because it is not defined as self.radius

Work Step by Step

(a) The initializer name in python is not the same name as class but __init__ also the variable radius will be considered as local variable not class variable because it is not written as self.radius (b) In python all class methods should have self as first parameter but the method setRadius does not have that also the variable radius will not be considered a class variable because it is not written as self.radius
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.