0

"Python Core" Code project 91 - Phone Number Validator

In course "Python Core" Code project 91 - Phone Number Validator 2 variants of code behaves strangely at https://www.sololearn.com/learning/eom-project/1073/356 1 variant Code --------------------------------------------------------- import re #your code goes here pattern = r"\A[189][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\Z" if re.match(pattern, "57345672"): print ("Valid") else: print ("Invalid") --------------------------------------------------------- and 2 variant --------------------------------------------------------- import re #your code goes here pattern = r"[189]\d{7}

quot; if re.match(pattern, "57345672"): print ("Valid") else: print ("Invalid") --------------------------------------------------------- With Input 57345672 returns "Invalid" in IDLE (Python 3.9 64-bit) But at the site https://www.sololearn.com/learning/eom-project/1073/356 It is written that Your Output "Valid" And I've got info that someone checked the code and it works

20th Aug 2021, 12:13 PM
Dmitry Arkhangelsky
2 Réponses
0
Dmitry Arkhangelsky , for me it looks like the code should work properly
20th Aug 2021, 12:38 PM
Lothar
Lothar - avatar
0
Can't understand what's wrong with it
20th Aug 2021, 12:48 PM
Dmitry Arkhangelsky