Skip to content

Add Two Polynomials Python Program

In this code there are four test cases. 1st and 2nd and 4th test cases are camed successfully but 3rd test case was not getting expected output. Please help me I got 12x^4 + 9x^3 – 5x^2x – 1 as output in 3rd test case but expected output is 12x^4 + 9x^3 – 5x^2 – x – 1 For Add

Does Python have a basename function that is equal to Unix basename?

documentation os.path.basename(path) Return the base name of pathname path. This is the second element of the pair returned by passing path to the function split(). Note that the result of this function is different from the Unix basename program; where basename for ‘/foo/bar/’ returns ‘bar&…

Iterate through release notes and count fixes per date

I hope you are well. I’m trying to find every instance of “Fix” in release notes, and grab the date (which is usually a line above). For example (section of release notes): I would want to grab the amount of “fix” occurrences and their corresponding date. Example output: Here is what I’ve been trying: Any hel…

grid with circular distances python

I have a 2d grid of dim q(rows) p(columns). The element of the grid are the indices of the element itself. So the element a[i,j]=(i,j). Now I need to create pair-wise distances between these points with circularity constraint, meaning that the element distance(a[i,p-1],a[i,0])=1 (I am using 0-index based matr…

reduce() to merge if there are blank DataFrame

I want to use reduce() function to merge data. However, sometimes some dataframe df1 to df8 might be blank (but there is at least one dataframe not be blank). And I do not want to detect which one. For example, this time df1 to df7 are blank and only df8 is non-blank. Next time df1, df2, df5 are non-blank. Ho…

Create and fill a DataFrame column based on conditions

I have a DataFrame and I need to create a new column and fill the values acording to how many words in a list of words are found in a text. I’m trying de code below: This code actually create a new column, but fill all the rows with the last ‘count_found_words’ of the loop. is there a right …