Category : arrays

Problem statement – Take 3 numbers as input array (without using map function) and print the min and max values in the array My solution- arr = input("Enter numbers ") #1 2 3 print(min(arr)) #returns empty print(max(arr)) #returns 3 Question- Why does max(arr) return the correct output and min(Arr) return an empty string? Source: Python ..

Read more

As title suggests, I have this document structure: { "_id":"ObjectId(""61e53553ac31665894ebf6bc"")", "questionID":"8", "questionContent":"find it", "questoinAnswer":"it’s here", "questionStatus":"active", "questionImage":"some image", "hints":[ { "hintID":"1", "hintSubject":"in you pucket", "hintContent":"bla bla bla", "hintType":"private, "hintStatus":"Active", "time":"2022-01-23 11:02:41.976391" }, { "hintID":"2", "hintSubject":"red sea", "hintContent":"bla bla bla", "hintMedia":"some media", "hintType":"puplic", "hintStatus":"Active", "time":"2022-01-23 11:05:47.567226" } ] } I want to retrieve only the values ..

Read more

I have following code snippet (which is part of a function) in python: def decode_netout(netout, anchors, obj_thresh, net_h, net_w): # print("netout print: ", netout.shape, netout[0]) grid_h, grid_w = netout.shape[:2] nb_box = 3 netout = netout.reshape((grid_h, grid_w, nb_box, -1)) nb_class = netout.shape[-1] – 5 boxes = [] netout[…, :2] = _sigmoid(netout[…, :2]) netout[…, 4:] = _sigmoid(netout[…, ..

Read more

I am trying to change the values of an array into smaller numbers like list = [1,3,7,3] into list = [1,2,3,2] I already have a few lines of code to keep it organized. def sortItems(list): counts = collections.Counter(list) sortedlist = sorted(list, key=counts.get, reverse=True) return sortedlist been crawling all over W3Schools and other forums but still ..

Read more