how to find the values of a sum with decimals [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 days ago.
Improve this question
I would like to know how to find the values of a list that result in the sum of a specific value example that I have a list of payments but a payment is found that comes from different values of the list that added together result in the total value of the payment
I just want to know how to find the values of a sum in a way to be program it

Related

How can i access the numbers in the index of this list [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 days ago.
Improve this question
So this is the list. The list contains 9 indexes and inside each indexes, there at least one position that contains more than one number. Is there a way to access each number in those posistions?
I have tried:
print(self.nums[0][1][0])
I thought that it would print out the first number of that posistion in the first index, but i recieved an error message instead.

Discоrd Bot Event [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 10 months ago.
Improve this question
is it possible to somehow put before.rules and after.sales into two arrays, then compare the number of elements in them and subtract not their number, but the elements, so that the rest can be output later?
example
To compare the lengths of two lists, you can:
>>> print(len(after.roles)-len(before.roles))
3
In this example 3 new roles were gained

Python make list from string [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have column with this kind of data:
I want to count how many times valu occur in a row. It is a string, so I want to convert this '63,63,63,63,63,63,63,63,63,63,63' to this ['63','63','63'...].
I there any way to do this quickly?
Thanks
if given string is s
l=s.split(',')
l is the required list

Multiplication of matrices stored in lists [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I am struggling to multiply lists as matrices in Python.
I have two lists (weights and returns) and I need to multiply them as: weights*TRANSPOSE(returns).
How are Weights and Return defined in your code?
You might be able to do the following:
#This sums the entries
matrixProduct = 0
for i in range(len(Weights)):
matrixProduct+= Weights[i]*Return[i]
#In case you meant to keep products of individual pairs of matrix entries (not sure from your notation):
matrixProduct = []
for i in range(len(Weights)):
matrixProduct.append(Weights[i]*Return[i])

What's the difference between these two "for ... in" statements? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What's the difference between these two codes? The first works, but the second doesn't...
total=sum(prices[k]*stock[k] for k in prices)
for k in prices:
total=sum(prices[k]*stock[k])
The second example is recreating the total on each iteration of the loop. Instead you must use something like this:
total = 0
for k in prices:
total+=prices[k]*stock[k]
This will set the total to zero initially, and increment the total for each iteration by the amount prices[k]*stock[k].

Categories