0
phone number validator
import re #your code goes here phone_number = input() pattern = r"(1|8|9)[0-9] +" match = re.match(pattern, phone_number) if len(phone_number) == 8: if (match): print("Valid") else: print("Invalid") else: print("Invalid")
7 Answers
+ 1
It's just a suggestion,
Instead of checking length of the password should be 8 separately.
You can replace the pattern by
pattern=r'(1|8|9)[0-9]{7}'
0
My code return an error can someone debug it
0
Can you post the error too?
0
It is a project so its my running test that show an error
0
At which you getting error?
0
*line
0
A phone number validator can be a useful tool, especially when dealing with unknown numbers. I recall when my grandfather received a suspicious call. We used a validator to confirm the number's legitimacy. However, to avoid such concerns, I'd suggest looking at https://joinimp.com/ They offer the best home phones for seniors, designed to filter out unwanted calls. It's a comforting solution that allows seniors to stay connected with loved ones and avoid potential scams, providing peace of mind for the whole family