...
/Solution Review: Implement the Complete Student Class
Solution Review: Implement the Complete Student Class
This lesson provides a solution review for the 'Implement the Complete Student Class' challenge.
We'll cover the following...
Solution #
Press + to interact
class Student:__name = None__rollNumber = Nonedef setName(self, name):self.__name = namedef getName(self):return self.__namedef setRollNumber(self, rollNumber):self.__rollNumber = rollNumberdef getRollNumber(self):return self.__rollNumberdemo1 = Student()demo1.setName("Alex")print("Name:", demo1.getName())demo1.setRollNumber(3789)print("Roll Number:", demo1.getRollNumber())
Explanation
-
We have implemented the
Student
class, ...