Help me in solving SEVENRINGS problem

My issue

My code

# cook your dish here
t = int(input())
for i in range(t):
    N , X = map(int , input().split())
    price = N * X
    price = str(price)
    price = list(price)
    if price[0] > 0 and len(price) == 5:
        print("YES")
    else:
        print("NO")
    

Problem Link: SEVENRINGS Problem - CodeChef

@sneha_siri

We could simple have checked if price was greater than the largest four digit number, (9 999), and smaller than the smallest six digit number, (100 000).

# cook your dish here
for _ in range(int(input())):
    n,x=map(int,input().split())
    n=n*x
    if((n>9999)and(n<100000)):
        print('yes')
    else:
        print('no')
1 Like

for i in range(int(input())):
n,x = map(int,input().split())

g = str(n*x)  # HERE WE USED TYPE CASTING CHANGE IT TO THE STRING 

if len(g)!=5:
    print('no')
else:
    if g[0] == '0':
        print('no') 
    else:
        print('yes')