Discоrd Bot Event [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 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

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.

how to find the values of a sum with decimals [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 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

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

Very new to python, wanting to add a new column named ‘Total’, which is the sum of other totals [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 2 years ago.
Improve this question
df['Total']= df.iloc[3:5].sum(axis=1)
returns NaN for some most values, why is this? They are all intergers.
Also is there a better way of doing this?
Check with add with columns slice
df['Total'] = df.iloc[:, 3:5].sum(axis=1)

How to swap the elements in a list while keeping their index the same if you don't know the index (Python) [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 5 years ago.
Improve this question
Say I have these two lists:
list1=["Green","2","Blue","4"]
list2=["1","Orange","3","red"]
If I wanted to swap the '3' with 'blue' how would I do if it if I don't already know the positions of the elements in the list?
I'm using Python 2.7
list1=["Green","2","Blue","4"]
list2=["1","Orange","3","red"]
l1 = list1.index("Blue")
l2 = list2.index("3")
list1[l1], list2[l2] = list2[l2], list1[l1]

Categories