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 a reduced version of the for loop.
Instead of simply iterating through the list, where you'd have to later reference the index to fetch a value, this version directly iterates through the elements of the string.
For example:
Listl=["a","b","c"]for(Strings:l)print(s);
Output: a
b
c
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 10: Binary Numbers
You are viewing a single comment's thread. Return to all comments →
It is a reduced version of the for loop. Instead of simply iterating through the list, where you'd have to later reference the index to fetch a value, this version directly iterates through the elements of the string.
For example:
Output: a b c