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.
as the input for number of students and subjects is given in same line, OP is spliting the input string into list and taking 2nd element of the list to iterate those many times.
Zipped!
You are viewing a single comment's thread. Return to all comments →
unkempt pubes:
what does the [1] after split() do??
here is solution of problem Zipped in python 2 and python 3 https://solution.programmingoneonone.com/2020/06/hackerrank-zipped-problem-solution-python.html
as the input for number of students and subjects is given in same line, OP is spliting the input string into list and taking 2nd element of the list to iterate those many times.
here is problem solution in python programming. https://programs.programmingoneonone.com/2021/02/hackerrank-zipped-solution-python.html
what does the [1] after split() do??
.split()returns list. [n] returns n-th element of that list.
It's a shortcut of skipping the first input (number of subjects) and going straight for the number of students
Updated solution is here
https://www.thecscience.com/2021/08/hackerrank-Zipped-in-python-problem-solution.html
nyc solution!!!!!!!!!!
Bad practice to use list comprehensions/map for printing items, better use for loop.
readability is highly decreased here.