<\/span><\/h2>\n\n\n\nLet’s dive into the interesting topic of regular expressions! You are given some input, and you are required to check whether they are valid mobile numbers.<\/p>\n\n\n\n
A valid mobile number is a ten digit number starting with a or .<\/p>\n\n\n\n
Concept<\/strong><\/p>\n\n\n\nA valid mobile number is a ten digit number starting with a or .<\/p>\n\n\n\n
Regular expressions are a key concept in any programming language.<\/p>\n\n\n\n
<\/span>Input Format<\/strong><\/span><\/h2>\n\n\n\nThe first line contains an integer N<\/em><\/strong>, the number of inputs.
N<\/strong><\/em> lines follow, each containing some string.<\/p>\n\n\n\n<\/span>Constraints<\/strong><\/span><\/h2>\n\n\n\n- 1 <= N<\/em> <= 10<\/strong><\/li>
- 2 <= len<\/em>(Number<\/em>) <= 15<\/strong><\/li><\/ul>\n\n\n\n
<\/span>Output Format<\/strong><\/span><\/h2>\n\n\n\nFor every string listed, print “YES<\/em>” if it is a valid mobile number and “NO<\/em>” if it is not on separate lines. Do not print the quotes.<\/p>\n\n\n\nSample Input<\/strong><\/p>\n\n\n\n2\n9587456281\n1252478965<\/code><\/pre>\n\n\n\nSample Output<\/strong><\/p>\n\n\n\nYES\nNO<\/code><\/pre>\n\n\n\n<\/span>Solution – Validating Phone Numbers in Python<\/strong><\/span><\/h2>\n\n\n\n# Enter your code here. Read input from STDIN. Print output to STDOUT\n\nimport re\n[print('YES' if re.match(r'[789]\\d{9}$', input()) else 'NO') for _ in range(int(input()))]<\/pre>\n\n\n\n