numpy results in segmentation fault

Thomas Jollans tjol at tjol.eu
Thu Sep 12 10:28:44 EDT 2019


On 12/09/2019 15.53, Pradeep Patra wrote:
> Hi ,
>
> I was trying to solve the hackerrank and was using python 3.7.x.
> https://www.hackerrank.com/challenges/np-concatenate/problem
>
> While running the code sometimes I get success result and sometimes it
> fails with "Segmentation Fault" at Hacker rank UI. I dont have any clue why
> the code is crashing ? Does anyone have any idea?


Are you sure it's your code that's crashing, and not something beyond
your control? (Such as the software that is starting Python for you)
Does it depend on the input? Can you reproduce the issue in a controlled
environment (i.e. on your own PC)?


>
> Regards
> Pradeep
>
> import numpy
>
> n,m,p = map(int,input().split())
> tgt_arr1 = []
> for i in range(n):
>     row = list(map(int,input().split()))
>     tgt_arr1.append(row)
> tgt_arr2 = []
> for j in range(m):
>     row = list(map(int,input().split()))
>     tgt_arr2.append(row)
>
> num_arr1 = numpy.array(tgt_arr1,int)
> num_arr2 = numpy.array(tgt_arr2,int)
>
> print(numpy.concatenate((num_arr1,num_arr2),axis=0))





More information about the Python-list mailing list