How to get the number of 50's and its exist number from number like 230

Advertisements I have number like 230. And 50 is always the limit. I want to get the following data: [50,50,50,50,30] I should get four 50’s and its exist number that is less than 50. example 2. Number = 400 I should get [50,50,50,50,50,50,50,50] example 3: Number = 110 I should get [50,50,10] >Solution : getResult(420,… Read More How to get the number of 50's and its exist number from number like 230

How do I add or subtract all the items in an array of integers efficiently in python?

Advertisements this question is less about a specific issue, and more about a problem that I continuously have while working with arrays. Say I have an array like this: x = [4,7,11] If I wanted to add al of these together, what I would do is: for i in range(len(x)-1): x[i+1] = x[i]+x[i+1] x[i] =… Read More How do I add or subtract all the items in an array of integers efficiently in python?