title: Python 3 - How to validate multiple user input
body: <p>I have created a function that takes input from a user and populates a list [Persons].
  In this function,i want to make some validations in order to safeguard the user input.</p>
  <p>i.e
  Please give only numbers.
  Please give only strings.</p>
  <p>I can validate user 'Name', but how can make validations on a second variable ('LastName').</p>
  <pre><code>persons = [
  {
      &quot;id&quot;: 1001,
      &quot;name&quot;: &quot;xxxx&quot;,
      &quot;lastname&quot;: &quot;xxx&quot;,
      &quot;fathers_name&quot;: &quot;xxxx&quot;,
      &quot;age&quot;: 34,
      &quot;class&quot;: 1,
      &quot;id_number&quot;: &quot;xxx&quot;
  },
  {
      &quot;id&quot;: 1002,
      &quot;name&quot;: &quot;xxx&quot;,
      &quot;lastname&quot;: &quot;xxx&quot;,
      &quot;fathers_name&quot;: &quot;xxxxx&quot;,
      &quot;age&quot;: 30,
      &quot;class&quot;: 3,
      &quot;id_number&quot;: &quot;xxxxxx&quot;
  },
  {
      &quot;id&quot;: 1003,
      &quot;name&quot;: &quot;xxxx&quot;,
      &quot;lastname&quot;: &quot;xx&quot;,
      &quot;fathers_name&quot;: &quot;xxxx&quot;,
      &quot;age&quot;: 16,
      &quot;class&quot;: 4,
      &quot;id_number&quot;: &quot;xxxx&quot;
  },]
  
  def create():
  person = {}
  while True:
      name = input(&quot;Give Name: &quot;).capitalize()
      person[&quot;name&quot;] = name
      if not name.isalpha():
          print(&quot;Please give a string...&quot;)
          continue
      else:
          break
  
  while True:
      lastname = input(&quot;Give LastName: &quot;).capitalize()
      person[&quot;lastname&quot;] = lastname
      if not lastname.isalpha():
          print(&quot;Please give a string...&quot;)
          continue
      else:
          break
  print(person)
  </code></pre>
  <p>create()</p>