It's my code to validate phone number in python | Sololearn: Learn to code for FREE!

-3

It's my code to validate phone number in python

import re pattern = r"^(1|8|9)[0-9]+" a = input() if len(a)==8: if re.match(pattern,a): print ("valid") else : print ("invalid") else: print ("invalid")

6/9/2021 8:50:03 AM

Md Shakil

4 Answers

New Answer

+2

Md Shakil With all due respect, if you don't have a question regarding your code, then this is not the place to post it. Please reserve this thread for code related Q&A only. PS: I haven't tested your code, but it looks clever. Well done!

+1

Md Shakil Your code logic is good, (better than mine) but your output does not meet the challenge requirements. Your outputs -> valid, invalid. Expected outputs -> Valid, Invalid. Good luck

+1

Thanks thanks thanks a lot of thanks It was only the matter of capital letter😂😂

-1

Oh yes I'm sorry for that My question is , why ,in result ,it shows incorrect even my output is as same as the expected output when i put the above code for solving phone number validator in python?? can you tell me what's wrong with that code