title: python repeats function 3 times
body: <p>The purpose of this code is to:</p>
  <ol>
  <li>Ask the user to enter his name.</li>
  <li>Ask the user to enter his date of birth</li>
  <li>The code will split the name into first, middle and last name</li>
  <li>The code will calculate the age in years, months and days.</li>
  <li>The code will store all these data in a dictionary</li>
  </ol>
  <p>Here is the code:</p>
  <pre><code>from datetime import datetime
  from dateutil.relativedelta import relativedelta
  
  
      class Test:
          def __init__(self):
              self.today = datetime.today()
      
          def name(self):
              first_name, middle_name, last_name = input(&quot;enter your name:\n&quot;.title()).split(' ')
              return first_name, middle_name, last_name
      
          def age(self):
              date_of_birth = input(&quot;enter your date of birth:\n&quot;)
              date_of_birth = datetime.strptime(date_of_birth, &quot;%d/%m/%Y&quot;)
              age = relativedelta(self.today, date_of_birth)
              return age
      
          def data(self):
              data = {&quot;first name&quot;: self.name()[0],
                      &quot;middle_name&quot;: self.name()[1],
                      &quot;last name&quot;: self.name()[2],
                      &quot;age years&quot;: self.age().years,
                      &quot;age months&quot;: self.age().months,
                      &quot;age days&quot;: self.age().days}
              print(data)
      
      
      Test().data()
  </code></pre>
  <p>The code makes no error.</p>
  <p>But the question for the name and the age repeated three times for each.
  something like this</p>
  <p>enter your date of birth:</p>
  <p>26/9/1986</p>
  <p>enter your date of birth:</p>
  <p>26/9/1986</p>
  <p>enter your date of birth:</p>
  <p>26/9/1986</p>