Skip to content
Advertisement

Tag: data-structures

Alias for long list name and modification

I have a nested data structure (e.g. mydict[names[num]]) which is difficult to read in code. Hence I would like to create a proxy (alias) and use it to modify this structure. Given the AssertionError on id(a) = id(b), do I understand correctly python separates short and long_name during comprehension and allocates separate memory? In practice, my structure contains millions of

Sort the list of tuples in python

I have tuples like this these are the coins and its expiries. The date is in string format, so the arrangement is wrong. so i have changed the format to date and tried to arrange. I have tried the below code. and the result is as expected as sorted. now when i want back in older format which i mentioned

Palindrome question use of lambda and key

Hey guys so I was working on this problem on the algoExpert platform, but I am struggling to understand what longest and currentLongest are really doing. Just from the beginning, I am not entirely sure what the currentLongest = [0, 1] is doing, is it just saying that it will have 2 values? Are odd and even returning an array

Getting KeyError in the following code to find “minimum number square to the number”

I am getting the error in the following code for the above stated problem using memoization please help me find the error and correct the code. Answer It would help if you provided the full error output, which should include the line number and surrounding code. However, I suspect the issue lies in the following line: You’re checking whether the

Advertisement