These are chat archives for andela/andela-21-lite

24th
Aug 2016
jnmunyua
@jnmunyua
Aug 24 2016 09:58
@carinaP2011 Yes its possible for them to see.
clarch
@clarch
Aug 24 2016 12:22
@Antoh1 I am not sure I understand what you mean could you modify the code and share so as to see it clearly
clarch
@clarch
Aug 24 2016 12:32
@carinaP2011 and @jnmunyua if you are referring to Windows Remote Desktop the other person cannot see what you are doing , although the server allows parallel sessions, that is two people can be logged in at the same time, they cannot view what the other person is doing, well unless one of you uses teamviewer but that would require authorization from the other person :smile:
clarch
@clarch
Aug 24 2016 13:25

@Antoh1 I think I understand your statement, do you mean that for every object created from Person() we put the if statement inside the object?
Well I did it this because I want to check the validity of the age, that self.age>1 always and since this is constant for all the objects that will be created I put it in the init otherwise I would have to put

if (self.age < 1):
             print("Age must be above 0")

inside every object created which means more lines of code and it will be repetitive, I don't know if there is a better way to do it and why it would not be readable kindly share. Hope I helped some :smile:

Anthony Tirop
@Antoh1
Aug 24 2016 14:15
This message was deleted
Anthony Tirop
@Antoh1
Aug 24 2016 14:20
class Person:
    age=0
    def __init__(self,initialAge):
        # Add some more code to run some checks on initialAge
         self.age = initialAge
      def  yearPasses():
          if initialAge <1:
              print("Age must be above 0")
          self.age = self.age + 1
@clarch this is what I actually meant. the condition should be in you class method not really when you instanciating your object
def yearsPasses(self):
My approach based on the python class's conventions