Phone Number Validator problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Phone Number Validator problem

What is wrong with my code? import re #your code goes here phone_number = int(input()) if(len(phone_number) = 8 and (phone_number[0] = 1 or phone_number[0] = 8 or phone_number[0] = 9): print("Valid") else: print("Invalid")

16th Jun 2021, 7:20 AM
Dariusz Jenek
Dariusz Jenek - avatar
2 Answers
+ 3
Hi! this is a task for the knowledge of regular expressions. please use them in your solution.
16th Jun 2021, 8:23 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
In if you must use the comparison operator, rather than equalizing if a == 1:
16th Jun 2021, 7:23 AM
Maxbro
Maxbro - avatar