mercredi 4 novembre 2020

Check if a specific charatcer of a string is numeric or alphabetic (python)

For example, I want a user to input the postal code. However, it has restrictions, such as the length of the postal code has to be 5; first, third, and fifth characters should be digits, while others must be letters. Otherwise, the program should display an error. I guess that I need to write a condition, but I haven't come up with the code, which will check if a specific character of the string is either numeric or alphabetic.

Aucun commentaire:

Enregistrer un commentaire