72,045 questions
Advice
2
votes
11
replies
238
views
How do I make a 'for' loop in python run infinitely?
In Python, we know that while loops can run infinitely,
but is there any way to make a for loop run infinitely?
From my prior checking, I found a way to do so by importing the 'itertools' module, but ...
0
votes
0
answers
52
views
for loop counter gives error for array index [duplicate]
Strangely, the following code returns an error stating that the array key 11 or 12 does not exist for the playersPool[$x]['gender']. When dumping the $playersPool array it usually returns a count of 9:...
Advice
1
vote
8
replies
163
views
JAVA : Looping through an unknown number of arrays
If I have two arrays of integers and wanted to do a specific function on them (for the sake of this example, add them together), I could stack two for loops like so:
int[] x = new int[]{1,2,3};
int[] ...
0
votes
1
answer
53
views
Loop through an array infinitely in Vlang
import time
import os
const spinner := [ '. ', ' . ', ' . ', ' . ', ' . ', ' .', ' . ', ' . ', ' . ', ' . ' ]
mut counter := 0
for {
os.flush()
if ...
-4
votes
2
answers
105
views
Extract directory structure from for loop search [closed]
I am using a for loop to recursively search through a directory for files of a specific file type, and then extract them to a different location. Right now I extract all of the files to the same ...
1
vote
1
answer
118
views
I want to delete rows from a Named Range that contains several items listed in MyArray. But I get an error if not found
Sub DELETE_Db_ROWS_THAT_CONTAIN_ITEMS_IN_AN_ARRAY()
Dim MyArray As Variant
MyArray = Array("Reinvest", "DBS", "WDL") 'Delete all rows containing these items
...
1
vote
1
answer
177
views
Why is try/catch within nested for loops substantially slowing down execution time? [duplicate]
I'm working on a tool to segment features from a grey scale image and as part of this I want to perform a gaussian blur. This is basically a way of learning more about C# and the underling image ...
4
votes
3
answers
258
views
Triangulating matrices using LU decomposition method in C : Question about for loop optimization
Matrices can be triangulated using less than ten lines of code in C, I have heard being said. But LU decomposition method needs to be used, instead of Cramer's rule. So, I was trying to do that. My ...
0
votes
1
answer
41
views
One line cmd nested FOR loop within FOR loop with delayed variable expansion (not in a batch file!)
I can't recall (and can't work out) if there is a way to have a cmd FOR loop nested within another FOR loop where for each outer FOR loop iteration, the inner FOR loop is iterated.
For example:
FOR /F ...
2
votes
1
answer
77
views
How to classify items into A/B/C DIF levels using deltaLord values in the difR package?
I am performing a DIF analysis using the difR package.
library(difR)
verbal <- verbal[colnames(verbal) != "Anger"]
abc <- difLord(verbal[, 1:24], group = verbal[, 25], focal.name = 1, ...
Advice
0
votes
8
replies
187
views
Finding the max values for list values for each key in a dictionary without using max()
Let's say I have a dictionary such as:
dict = { "Mars": [4, 3, 4, 7, 10], "Jupiter": [6, 6, 7, 9, 11], "Saturn": [4, 5, 12, 22, 1]}
I would like to iterate through each ...
-1
votes
1
answer
99
views
Put all row from a data in a list
I am having a problem to put an entire row from data in a list
import pandas as pd
import numpy as np
import csv
df= pd.read_csv ("data.csv")
my_list = [] # list
for n in range(1, ...
-1
votes
1
answer
85
views
Using list to find variables from data in rows [closed]
I am trying to find a combination where it will go through the data to find matched variables for any value from the list First_row is found, any value from the list Second_row and any value from the ...
4
votes
3
answers
185
views
Why does my C code display the correct output, but with garbage characters added after?
The practice question I am working on reads as:
Read two strings, both of them do not contain white spaces (but may contain non-alphanumeric, such as â,â, â.â, â/â ...).
Display the first string ...
-2
votes
1
answer
85
views
DO Error during String Replacement using Windows Batch Script
I obtained a batch script from Google AI for performing string replacement on the content of a list of text files in Windows. This is what I got--with a little tweaking, first. (Just testing at this ...