Jun-06-2018, 12:18 PM
Hi all. I don't know from where "None" come. Of course I should like to get rid of them.
class FirstClass: def setdata(self, value): self.data=value def display(self): print(self.data) x=FirstClass() y=FirstClass() x.setdata("King Arthur") y.setdata(3.14159) print(x.display()) #King Arthur print(y.display()) #3.14159 x.data="Age of King Arthur" print(x.display()) #Age of King Arthur x.anotherInteger=67 print(x.anotherInteger) # 67And now the Output
Output:λ python class1.py
King Arthur
None
3.14159
None
Age of King Arthur
None
67