In this HackerRank Validating phone numbers problem solution You are given some input, and you are required to check whether they are valid mobile numbers. A valid mobile number is a ten-digit number starting with a 7,8 or 9.

HackerRank Validating phone numbers in python problem solution

HackerRank Validating phone numbers in python problem solution

import re

for _ in range(int(input())):
  number = input()
  match = re.match('^[789][0-9]{9}$', number)
  if match:
    print('YES')
  else:
    print('NO')