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.
There's no need to check if the given number is between 1 and 100; on the problem it reads that whatever numbers the site throws at your problem, they are never smaller than 1 or higher than 100.
Now, when it comes to the actual problem this hardly even matters; if you have done exactly as the problem specificaspecifications instructed, it can theoretically handle any integer. The reason the range of possible numbers is limited is because the ultimate point of this exercise isn't working with huge numbers, it's all about learning how to use if-elif-eif-elif-else.
That being said, nowhere in my code am I checking the validity of the input. In this environment, there's no need to.
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 →
There's no need to check if the given number is between 1 and 100; on the problem it reads that whatever numbers the site throws at your problem, they are never smaller than 1 or higher than 100.
Now, when it comes to the actual problem this hardly even matters; if you have done exactly as the problem specificaspecifications instructed, it can theoretically handle any integer. The reason the range of possible numbers is limited is because the ultimate point of this exercise isn't working with huge numbers, it's all about learning how to use if-elif-eif-elif-else.
That being said, nowhere in my code am I checking the validity of the input. In this environment, there's no need to.