...

/

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 = None
def setName(self, name):
self.__name = name
def getName(self):
return self.__name
def setRollNumber(self, rollNumber):
self.__rollNumber = rollNumber
def getRollNumber(self):
return self.__rollNumber
demo1 = Student()
demo1.setName("Alex")
print("Name:", demo1.getName())
demo1.setRollNumber(3789)
print("Roll Number:", demo1.getRollNumber())

Explanation

  • We have implemented the Student class, ...