Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
3 answers
30 views

How to call a number from a multi-dimensional complex list

I'm trying to make a sophisticated quiz that involves a list for a question and an answer that is included in a list. I want to call numbers from this multi-dimensional list using a "for" ...
Breadification's user avatar
0 votes
0 answers
38 views

Difference between appending a list and appending a copy of list [duplicate]

I need to understand the difference between appending a list and appending the copy of a list in python. This is the code: res=[1,2,3] res1=[1,2,3] c1=[5] res.append(c1.copy()) res1.append(c1) print(...
Ankit's user avatar
  • 11
-1 votes
5 answers
50 views

Focusing on an element of a subset, of a subset

Fairly new to coding and I have a question regarding list and subsets. Suppose this is my list: list = [[[a,2], [c,3], [e,3]], [[g,4], [i,4] [k,3]], [[b,3], [d,2], [f,2]]] How would I go about making ...
Junior Salvador's user avatar
2 votes
2 answers
40 views

How to match elements from input to list

I'm currently working on a Caesar cipher program, and I basically typed up a list of the alphabets: alphabet = ['a','b','c','d',...] Then asked the user for a word to encrypt, text = input('Enter your ...
Soham Karalkar's user avatar
0 votes
1 answer
22 views

Python scipy integrate.quad with TypeError: 'NoneType' object is not iterable

I am trying to define the following integral using scipy: and here is my code: import numpy as np import scipy.integrate as integrate from scipy.stats import norm def integrand(xi, thetai, *theta): ...
Ishigami's user avatar
  • 239
-3 votes
0 answers
41 views

Pulling random list choice from a list of lists in Python [closed]

I have a list of RGB values generated from an image: color_list = [(192, 155, 120), (132, 81, 65), (226, 226, 199), (76, 94, 117), (140, 157, 178), (17, 34, 54), (217, 213, 139), (134, ...
Sean Cannon's user avatar
-1 votes
0 answers
36 views

Identify empty lists in 2d List / list of lists

I have an Excel file with 10000 customer ratings. Each row is a rating (row 1 = rating 1; row 2 = rating 2, ... ). I import these into Jupyter Notebook and clean them up. (lematization, remove ...
Uriaah's user avatar
  • 11
0 votes
1 answer
68 views

For loop not appending array with regex

The following code fetches version numbers from a URL, and then for each version number, goes to a page for that version number and fills an array with a specific pattern for a filename. The resulting ...
megalamehaxxor's user avatar
-5 votes
0 answers
51 views

Filtering a Python list with a np.array of indices

Could anyone explain to me how the list self.data is indexed/filtered with a numpy array of indices selec_idx? The full class is available at https://github.com/kaidic/LDAM-DRW/blob/master/...
Baraa's user avatar
  • 6
-2 votes
1 answer
33 views

Selecting items with special features from a list and transferring them to a new list [duplicate]

I'm new to programming and I'm learning Python, so my question might seem clumsily: If we have a list (for example, a list of different names) and we want the names that end with a special letter (for ...
yasaman's user avatar
  • 11
-4 votes
1 answer
65 views

Why do I get "NoneType object is not iterable" when filtering a list of dictionaries with list comprehension and handling None? [closed]

I'm trying to filter a list of dictionaries in Python using list comprehension. I am handling None values, but I keep getting the error "NoneType object is not iterable". I expected my code ...
Harold's user avatar
  • 5
1 vote
2 answers
75 views

How to find duplicates in a text file in python and create a new text file with out them

I am trying to remove duplicates from text files to make a current process more efficient Example input: 1 1 1 1 2 1 3 1 4 1 Example Output: 1 1 2 1 3 1 4 1 my issue is when ...
Kaleb Brookshire's user avatar
-4 votes
1 answer
54 views

How to convert a tuple which includes a [string] to a dictionary item

I have this list: address_table3 = [(1, ['21 South Main']), (2, ['1560 West St']), (3, ['1900 Broadway'])] I want to convert it to a dictionary with the address as key and integer as value. When I ...
John Fox's user avatar
-1 votes
0 answers
48 views

cleaning list object containing text and creating new variables using Python

I am trying to create a data frame running the following code - # pip install edgartools import pandas as pd from edgar import * # Tell the SEC who you are set_identity("Your Name youremail@...
Sharif's user avatar
  • 177
0 votes
1 answer
21 views

How to make a flexible argument list for cursor.execute in python3?

In fact, I want to increase and decrease the mysql query items and the values ​​(arguments) according to the status of the variable values. based on my scenario I need to make a flexible mysql query ...
Alireza Mirhabibi - IRAN's user avatar

15 30 50 per page
1
2 3 4 5
4758