Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Calculate the sum of the differences inside tuple
Post: Calculate the sum of the differences inside tuple
Hello everyone,
I would like to calculate the sum of the differences between each value for each tuple. For instance :
(4,7,9) would give 3 (7-4 = 3) and 2 (9-2). And the sum of these differences wo... |
|
PUP280 |
General Coding Help |
4 |
1,182 |
Aug-12-2022, 04:10 PM |
|
|
Thread: Check common element in tuples
Post: RE: Check common element in tuples
That's awesome, thank you !
The good answer, for my need, was this one :
def find_matches(tuples):
result = [False] # <- Was incorrectly set to True
for i in range(len(tuples)-1):
... |
|
PUP280 |
General Coding Help |
10 |
5,841 |
Nov-05-2020, 05:01 PM |
|
|
Thread: Check common element in tuples
Post: RE: Check common element in tuples
I don’t understand the result of your first code. Can you explain it a little bit more please ?
About the result, I confirm my desired output :
Output: 1 : false
2 : true
3 : false
4 : trueBecause :... |
|
PUP280 |
General Coding Help |
10 |
5,841 |
Nov-01-2020, 04:55 PM |
|
|
Thread: Check common element in tuples
Post: Check common element in tuples
Hello,
I would compare multiple elements with a previous tuple in a list of tuples.
Example :
Input :
Ts = [(45,50,30,21), (30,9,56,3), (56,10,21,4), (41,30,50,56)]Desired output :
Output:1 : fal... |
|
PUP280 |
General Coding Help |
10 |
5,841 |
Nov-01-2020, 03:42 PM |
|
|
Thread: Add items from one list to list of lists
Post: RE: Add items from one list to list of lists
|
PUP280 |
General Coding Help |
5 |
2,929 |
May-05-2020, 03:47 PM |
|
|
Thread: Understand list comprehension and draw
Post: RE: Understand list comprehension and draw
Hello,
Thank you very much ! I have other questions but I've learned a lot with your help. First, I need to practice with these techniques.
Maybe see you soon, anyway thanks again. |
|
PUP280 |
General Coding Help |
9 |
3,956 |
Apr-23-2020, 05:25 PM |
|
|
Thread: Understand list comprehension and draw
Post: RE: Understand list comprehension and draw
Thank you for your patience and this lot of informations.
I discover this possibility :
things = []
for x in range(0, 7):
for y in range(x+1, 8):
for z in range(y+1, 9):
thin... |
|
PUP280 |
General Coding Help |
9 |
3,956 |
Apr-20-2020, 05:23 PM |
|
|
Thread: Understand list comprehension and draw
Post: RE: Understand list comprehension and draw
Hello,
Thanks everyone. I notice I wasn’t clear, sorry.
I know itertool.combinations but, except if I am wrong, I believe that we can not have multiple iterators with it. I explain :
my_example = [(... |
|
PUP280 |
General Coding Help |
9 |
3,956 |
Apr-19-2020, 06:44 PM |
|
|
Thread: Understand list comprehension and draw
Post: Understand list comprehension and draw
Hello,
I'm a beginner and I try a lot of things with list comprehension to understand it. Considering that, I don't understand some things.
First, how can I do only one draw by combination ? I expla... |
|
PUP280 |
General Coding Help |
9 |
3,956 |
Apr-18-2020, 05:07 PM |
|
|
Thread: Add items from one list to list of lists
Post: RE: Add items from one list to list of lists
Hello,
At first, thank you for the edit from the moderator, I had not found how to present it, now I know. Thanks again.
For the letters, thank you. I'm a beginner, I knew that but as it was just an... |
|
PUP280 |
General Coding Help |
5 |
2,929 |
Mar-28-2020, 08:34 AM |
|
|
Thread: Add items from one list to list of lists
Post: Add items from one list to list of lists
Hello,
I would like to add every element of a list on every list from a list of lists. Ie :
H = [[1,2],[3,4]]
I = [5,6]With this result :
Output:J = [[1,2,5], [3,4,5], [1,2,6], [3,4,6]]I don’t find t... |
|
PUP280 |
General Coding Help |
5 |
2,929 |
Mar-24-2020, 10:50 AM |