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.
It is because the range method is inclusive for the lower bound while exclusive for the upper bound. For Example, range(2,5)= 2,3,4 while range (2,6)= 2,3,4,5. When using the range function, make sure you increase n by 1, i.e the upperbound be n+1.
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 →
It is because the range method is inclusive for the lower bound while exclusive for the upper bound. For Example, range(2,5)= 2,3,4 while range (2,6)= 2,3,4,5. When using the range function, make sure you increase n by 1, i.e the upperbound be n+1.