Here: while len(iPinNo) < 4:
iPinNo
is an integer, and you’re not supposed to call len()
on integers (hence the error): the object passed to len()
must be a sequence or a mapping.
Convert it to a string first, using str()
, then call len()
, to get the amount of digits.