0

Why test case 3 failed?

import re pattern = r"^(1|8|9)[0-9]{7}" phone = input() if re.match(pattern,phone): print("Valid") else: print("Invalid")

21st Feb 2021, 3:20 AM
UMASANKAR RAMALINGAM
UMASANKAR RAMALINGAM - avatar
3 Respostas
+ 2
try with pattern = r'^(1|8|9)[0-9]{7}
#x27; to match full string only ;) ... or shorter: r'^[189]\d{7}
#x27;
21st Feb 2021, 3:51 AM
visph
visph - avatar
0
$ at the end worked... Thank you so much.
21st Feb 2021, 3:56 AM
UMASANKAR RAMALINGAM
UMASANKAR RAMALINGAM - avatar
- 2
Don't Know 😏 I'm a beginner but will become Experienced and Professional soon, because I Have Self-confidence !👍🏻 Then, I'll answer this,.. if I will remember..😀
21st Feb 2021, 3:47 AM
Badal Choudhary
Badal Choudhary - avatar