May-23-2018, 05:14 AM
If I were going to do this, I'd check the length of the return value of input() (or the size of num1) and then re-prompt the user on rejection. If you are really serious about limiting the number of typed characters... I'm not as sure. I'd look at the curses module, or consider a GUI of some kind (likely a web server, like Flask, or Kivy since it would be easier to get working on Android). Other options would be platform-specific, which you might be fine with but I wouldn't be sure how to go about it.