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.
Next the code goes through the list (range(1,4) = [1,2,3]), element by element, and prints each number. It first prints 1, then 2, then 3. It doesn't go to the next line bc end='' and instead prints them next to each other.
Make sense?
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 →
range
produces alist
and it doesn't change once it's produced.I made a mistake above, it
print
s out alist
([]
instead of()
) becauserange
is just a way to make alist
:Next the code goes through the
list
(range(1,4)
=[1,2,3]
), element by element, and prints each number. It first prints 1, then 2, then 3. It doesn't go to the next line bcend=''
and insteadprint
s them next to each other.Make sense?