Exercise: Printing and Comparing the Class Objects
Let’s try to print a string representation of a class object's contents and compare these objects.
We'll cover the following...
Problem statement
You have been provided a Person
class with the variables name
and age
.
One of your tasks is to add a __str__()
function to the Person
class to be able to print the contents of your object. Your function should print the name
and ...