title: Limit the length of an inputted string in python
body: <p>I am a complete beginner in Python and I'm trying to make improvements in my code for my GCSE Computer Science coursework. 
  All I want to be able to do is limit the number of digits inputted to 7.
  Here is all of what I have so far: </p>
  
  <pre><code>print("Hello")
  time.sleep(0.5)
  print("What is your 7-digit product number?")
  while True:
  try:
      productnumber=  (str(int(input(" "))))
      break
  except ValueError:
      print("Please only enter numbers")
      time.sleep(1)
      print()
      print("What is your 7-digit number?")
  </code></pre>
  
  <p>Any help is appreciated, I tried adding a nested loop but I've had no luck so far with anything I do, as I mentioned before, I am a compleeete beginner. 
  Thanks a lot!</p>