Sort by

recency

|

461 Discussions

|

  • + 0 comments
    import re
    p = r'^[789]\d{9}$'
    for _ in range(int(input())):
        print("YES" if re.match(p, input()) else "NO")
    
  • + 0 comments
    import re
    
    N = int(input())
    valid_pattern = r'^[789]\d{9}'
    
    for _ in range(N):
        string = input()
        validity = re.match(valid_pattern, string)
        print('YES' if validity else 'NO')
    		
    		
    		
    		
    		I try to be as straight as possible! to be comprehensible at most
    
  • + 0 comments

    I do it like this is it legal?

    Input = int(input())

    for i in range(Input):

    number = input()  
    output = "NO"
    if number.isdigit():
        if len(number) == 10 and number[0] in ['7', '8', '9']:
            output = "YES"
    print(output)
    
  • + 0 comments
    import re
    
    N = int(input())
    for _ in range(N):
        phone_number = input().strip()
        if re.match(r'^[789]\d{9}$', phone_number):
            print("YES")
        else:
            print("NO")
    
  • + 0 comments
    from re import match
    [print("YES" if match(r'^[789]\d{9}$', input()) else "NO") for _ in range(int(input()))]