All Questions
Tagged with python-3.x list
13,978
questions
-3
votes
0
answers
20
views
how can I compute the striking force of a football player using python [closed]
in a football match between England and Spain Julius Fueke needs a decisive goal, write a Python program that can compute the striking force of each of the players
i tried using the import numpy but ...
-7
votes
0
answers
47
views
How this line works? (python) [closed]
def max_subarray_sum(nums: list) -> int:
pass
print(max_subarray_sum([-2,1,-3,4,-1,2,1,-5,4]))
I want to know how the print line statement works in this program? I hope understanding this ...
0
votes
0
answers
39
views
Add loop list in python selenium find by xpath
keylist = ['1468384','1374165','1335571','1322769']
for item in keylist:
driver.get(f"mylinkshow_by_id=" +item) working 1 by 1
Firstname= driver.find_element(By.XPATH, ("//input[@name='...
-1
votes
0
answers
28
views
how to unlink lists in 2d list: [[None]*10]*10 [duplicate]
Maybe a very simple question, but if I create a list like the following:
[[None]*10]*10
the inner lists are always the same. sort of linked. that means that if i do this:
data = [[None]*10]*10
data[0]...
0
votes
2
answers
44
views
what is the most efficient way to gather all points at a certain height?
I have a List[List[int]] that represents points [x,y]
points = [[1,2],[1,3],[2,1],[2,3]]
What is the most efficient way to gather-up all the points with a specific height ?
So if we want all points ...
-1
votes
1
answer
44
views
Is there a way to take a lists first element of a list and make it the first items key and second element make it the first items value in python
I have come across a small problem when working on a particular programming exercise
In this exercise I am supposed to get data from a file which contains world series winning teams
example something ...
-1
votes
2
answers
63
views
Convert a list of tuples to a list of lists from a dataframe row
I am reading a csv to a dataframe and want to pull out a column from that dataframe and turn it into a list of lists. The data in the column looks like this:
[(123, 456), (789, 101), (321, 654)]
[(...
1
vote
3
answers
40
views
list indices must be integers or slices, not tuple - Python -Poker
I would like some help. The goal os this function is to find if there is a pair in a set of cards and find out which are them.
I am able to reach the value with the print command, but my for loop is ...
1
vote
1
answer
36
views
sorting a list of tuples using lambda, python [duplicate]
I have a list of tuples that contains (name, score).
I want to sort the list on the second element (reverse = True) and if two names are similar then sort it on first element but not using reverse.
I ...
-1
votes
2
answers
51
views
Can I write a changing integer value to a list in a loop without overwriting the previous value? [closed]
I have a for loop with an if statement checking if the current character in 'phrase' is equal to a character in 'dictator[column]' and if it is, it will append the position of a character to a global ...
0
votes
0
answers
71
views
Data structure help in python
I am learning about using algorithms and data structures for my class. I'm having some problems with a lab about stacks. I'm running into an issue with my InsertAtCommand object, its supposed to go ...
0
votes
1
answer
65
views
QuickSort implementation (inclusion vs exclusion a pivot element during partition)
I am trying to figure out the QuickSort algorithm. I have tried different implementations. The problem I have relates to the inclusion/exclusion of a pivot element.
Consider these three ...
0
votes
0
answers
30
views
Every second item in python list is disappearing in flask app [duplicate]
I have a flask application (Python 3 / Flask 2.2.5) which I am doing a once-off import of data using a flask custom command, the data is being imported via an API.
As there are many thousands of items,...
0
votes
0
answers
93
views
What am I doing wrong in this array sorting?
I have this code that searches the minimum value and the maximum value in a list, adding and reducing the range of where will it search for those values, but the list ends up close to be sorted, but ...
-3
votes
1
answer
391
views
LeetCode 121 problem: Best Time to Buy and Sell Stock [closed]
You are given an array prices where prices[i] is the price of a given stock on the ith day.
You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in ...