We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Even I was facing the same issue, problem with my code was, the wrong additional closing bracket after 6 in below line, maybe it happened due to autotyping:
(check[n%2==0 and (n in range(2,6))or n > 20])
Correct line, remove that additional bracket and add it after 20, then both the condition will be evaluated properly:
(check[n%2==0 and (n in range(2,6)or n > 20)])
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Python If-Else
You are viewing a single comment's thread. Return to all comments →
Even I was facing the same issue, problem with my code was, the wrong additional closing bracket after 6 in below line, maybe it happened due to autotyping:
(check[n%2==0 and (n in range(2,6))or n > 20])
Correct line, remove that additional bracket and add it after 20, then both the condition will be evaluated properly:
(check[n%2==0 and (n in range(2,6)or n > 20)])