Python problem [ Solved ] | Sololearn: Learn to code for FREE!


Python problem [ Solved ]

Hay freinds I was trying to do my RE problem of python course. Which is last 2nd que of the python course My try \/ import re #your code goes here a = input() pk = re.findall("^[189]\d{7}",a) if len(pk) != 0: print("Valid") else: print("Invalid") But 1 test case is failing continually. Can anyone help me to solve this. Code problem name : Phone Number Validator Position : last second problem of python course

10/11/2020 5:06:39 AM


7 Answers

New Answer


Your code is almost done: You just need to add the $ at the end of your expression to match the end of the line. Furthermore, consider use re.match() because you only need one match.


Rishu Tiwary please answer 🥺🥺


Can you copy paste the question I am not able to understand which question are you talking about 🤔


You can check this code Hope that it will get you


Use iteration! for I in range(len(a)):


import re a = input() pk = re.findall("^[189]\d{7}$",a) if len(pk) !=0: print("Valid") else: print("Invalid") I tried this. Its right.