0

How can i make my input accept a certain number of characters.

Pin=input("enter five digit")

25th Apr 2021, 5:27 PM
Benjamin
Benjamin - avatar
2 Answers
+ 2
Benjamin Usually you can't but you can validate through string length. pin = input() if len(pin) > 5: print ('Enter 5 digits number') else: print (pin)
25th Apr 2021, 5:34 PM
A͢J
A͢J - avatar
25th Apr 2021, 5:39 PM
Benjamin
Benjamin - avatar