0

Python phone validator

I can’t get past this challenge in the Python learning path. A valid phone begins with 1,8,9 and is 8 characters long. I used this regex in an online editor and this works but I’m not sure why Python code isn’t accepting this for the tests? import re #your code goes here pa = r"^[189][0-9]{7}

quot; str = "92345678" match = re.search(pa, str) if match: print("Valid") else: print("Invalid")

23rd Nov 2020, 2:48 PM
Zach Rebstock
Zach Rebstock - avatar
3 ответов
+ 1
is it there not required to take input? str = input()
23rd Nov 2020, 3:06 PM
Jayakrishna 🇮🇳
0
thanks for the reply. I assigned the str to input() and that allowed me to pass. thanks!!!!
23rd Nov 2020, 3:12 PM
Zach Rebstock
Zach Rebstock - avatar
0
You're welcome..
23rd Nov 2020, 3:18 PM
Jayakrishna 🇮🇳