0

I'm quite new to Python and programming so I just wanted to know how to restrict the user input to a certain length. For example, if the length of a credit card number is 16 digits and I wanted to restrict the length of the input to 16, how would I go about doing that?

  • 2
    It has been already answered here: https://stackoverflow.com/questions/54952296/how-can-i-limit-user-input-length-on-python – Learner Jul 20 '21 at 07:55
  • After they enter the number, check if the length is longer than 16. If it is, loop back and ask again. – Barmar Jul 20 '21 at 07:58

0 Answers0