Questions tagged [for-loop]
A for loop is a control structure used by many programming languages to iterate over a range. It is a way of repeating statements a number of times until the loop ends. Depending on the language this may be over a range of integers, iterators, etc.
for-loop
72,050
questions
-2
votes
1
answer
27
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 ...
0
votes
0
answers
9
views
Run Wilcox.tests across two years for two different places, with multiple subgroups
I want to run wilcox.test to compare Yr1 and Yr2 for each Gear within each Village.
e.g.
Village A Gr1 - Yr1 vs Yr2
Village A Gr2 - Yr1 vs Yr2
Village B Gr1 - Yr1 vs Yr2
My dataframe looks like:
# DF1
...
-1
votes
0
answers
39
views
Windows command using tokens & delimiters works from the command line but not in a batch file. EVEN WHEN the extra % is added
When I have the appropriate window open the following command works from the command line:
FOR /F "tokens=1 delims=," %A in ('tasklist /FI "WINDOWTITLE EQ Backup - C:\Backup.bat\"&...
0
votes
0
answers
20
views
How to create directory using part of long file name and move all files with that part of file name into directory [closed]
I have named my files as follows :
01 - Jan 04, 2020 - 102513
01 - Jan 04, 2020 - 102611
01 - Jan 04, 2020 - 102840
01 - Jan 06, 2020 - 183022
01 - Jan 06, 2020 - 195230
What I want to do is create a ...
-5
votes
0
answers
78
views
C++ For Loop is not working correctly and cant find the bug [closed]
i have been working on a c++ program that calculates the arithmetic, geometric and harmonic means.
the first instance of the calculation gives the correct figures for the arithmetic, geometric and ...
-1
votes
3
answers
72
views
Todo list using array and loop
I want to create a todo list using array and loop and display the list in div container. I am able to display the list but it is muliplying the same list stored and is displayed.
<body>
<...
0
votes
0
answers
5k
views
Iterations and multi-replacement
I have a file named file.in that contains 6 columns of data. One of the columns contains the mean and another contains the error. File.in is around 900 lines long with a different value for mean and ...
-1
votes
1
answer
54
views
Get the list of nested folders in directory and filter by name in batch script
I am trying to write a batch function where i need exclude some folders while searching in directory
Main Folder
--ProjA Folder
--A Folder
--A.csproj
--Aa Folder
-Aa.csproj
...
0
votes
0
answers
39
views
Speed up for loop to merge two dataframes in pandas
This is my code:
import time
st = time.time()
# Determine the smaller DataFrame
if len(purp_expanded) <= len(demog_expanded):
smaller_df = purp_expanded
larger_df = demog_expanded
...
0
votes
2
answers
61
views
Is the & operator is essential to use as address operator [duplicate]
#include<stdio.h>
int main()
{
int a[5]={5,10,15,20,25};
int *p;
int i;
p=a;
for (i=0;i<=5;i++)
{
printf("the address of the %d is = %d\n",*p,p);
...
0
votes
2
answers
67
views
Bash loop on two sets of files simultaneously
I have two sets of files in the same directory :
1.bam
2.bam
3.bam
and
1.txt
2.txt
3.txt
I need to run a command where 1.bam and 1.txt are interpreted together, and so on..
I tried looping through ...
-3
votes
2
answers
62
views
How to skip first element of each row in csv file without changing csv file
I am using a for loop in python to convert the values from the csv file into integer and float then putting them in a list in the code itself but the problem is with that the csv file doesn't only ...
0
votes
0
answers
45
views
How can I get my for loop to work in R to count occurrences? [closed]
I am running a for loop in R for a data frame "WOS" searching in its columns "Article Title" and "Abstract" for specific terms listed in the data frame "Combined_633&...
0
votes
1
answer
30
views
For loop in react using cards
I'm working on recipe project . I have fetch the all data from an API like image ,video ,ingredients into the react cards.
Now i want to the Ingredients for each card as per need . For example card1 ...
0
votes
0
answers
53
views
VBA Looping with multiple variables
I have a worksheet with multiple tabs. What’s the best method to loop through multiple iterations of variables. I’m showing the code I have for one iteration and would like to repeat that code ...