Python phone validator | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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 šŸ‡®šŸ‡³