I am creating a program where the user must guess the random number between 1-20. But, the user must type their name first (or at least a character). I can't seem to force the user to type something. How do I force the user to type something? Here's my source code: https://gist.github.com/AmmarFMR/dca16caf88c4c0b2d1b10a97becf3592
I also faced the problem at the end when a question is prompted to the user, "Do you want to play again? (Y/N)". The user could bypass the choices by either pressing enter twice or characters other than Y/N twice. How do I fix this?
And, I am sure that my simple program could be written in a more effective or shorter way. Please feel free to suggest improvements.