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.
n=int(input("enter the no."))
if((2<=n<=5)%2==0):
print(n)
else:
print("wrong no")
HI, friends,
I got an error on this code that I want the values from 2 to 5 but I found that this statement always gave a true and display the output any friend can explain why this is happening
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Day 3: Intro to Conditional Statements
You are viewing a single comment's thread. Return to all comments →
n=int(input("enter the no.")) if((2<=n<=5)%2==0): print(n) else: print("wrong no")
HI, friends, I got an error on this code that I want the values from 2 to 5 but I found that this statement always gave a true and display the output any friend can explain why this is happening