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.
I reckon you're new to python. See, when the array is provided at input in a single line, we cannot take the input like this, i.e. You're taking whole line as an input and storing this whole line in the array a, after the first input, it will show errors because only one line of input is available, while you're asking for n continouos lines. So, The best method is to use list(map()) or/and input().split() to store array elements given in a single line. Hope this helps :)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Lonely Integer
You are viewing a single comment's thread. Return to all comments →
I reckon you're new to python. See, when the array is provided at input in a single line, we cannot take the input like this, i.e. You're taking whole line as an input and storing this whole line in the array a, after the first input, it will show errors because only one line of input is available, while you're asking for n continouos lines. So, The best method is to use list(map()) or/and input().split() to store array elements given in a single line. Hope this helps :)