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())
*range (1, n+1) = range is from 1 to n, exclusive of n.
so if your input is 3 then it prints 1 2. So input to the range function is 1 to n+1
if you don't give sep='' in print statement then each value is seperated by a space
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Print Function
You are viewing a single comment's thread. Return to all comments →
n = int(input()) *range (1, n+1) = range is from 1 to n, exclusive of n. so if your input is 3 then it prints 1 2. So input to the range function is 1 to n+1
if you don't give sep='' in print statement then each value is seperated by a space