Skip to content

Python coding standard for Safety Critical Applications

Coming from C/C++ background, I am aware of coding standards that apply for Safety Critical applications (like the classic trio Medical-Automotive-Aerospace) in the context of embedded systems , such as MISRA, SEI CERT, Barr etc. Skipping the question if it should or if it is applicable as a language, I want …

Python: numpy.sum returns wrong ouput (numpy version 1.21.3)

Here I have a 1D array: And the sum of all elements in the array should be 75491328*8*8 = 4831444992. However, when I use np.sum, I get a different output. That’s what happens on my Jupyter Notebook using the latest version of Numpy. But when I use Jupyter Notebook of Coursera using old version 1.18.4 o…

Calculating the number of starts, by customer using Pandas

I have DataFrame that looks like: df I’m trying to calculate the beginning and end date for each, which I think is pretty straight forward (i.e., first time each customer customer and last time, as defined by amt > 0). What I need help with is calculating the number of new acquisitions, whether it&#8…

Python – Ordering a dictionary with the array from file

I have been trying to fetch the last and first field from the /etc/passwd file in Linux. I want to fetch the last fields of the file(the shell which users are using) and the first field(number of users using the shell) and add it to a list. For eg my final output must be something like Basically, I want the