0
Python Course, Phone Number Validator Question - What could "test case 3 be"?
Hi, I wrote this code as an answer: import re #your code goes here pattern = r"\A(1|8|9)\d{7}" number = input() if re.match(pattern, number): print("Valid") else: print("Invalid") (not working) r"\A(1|8|9)\d{7}" (works) r"\A(1|8|9)\d{7}
quot; What does "quot; change that the test case 3 gives no error? I mean... what could Test Case 3 be? I tried putting "\Z" but didn't work. Please enlighten me about the possible causes. ;-;2 Answers
+ 1
$ mean end of text, that after 7 digitals (d{7}) no more text or nums
+ 1
U need mark start of string too by ^, but u use \A (for text)