Skip to main content

Questions tagged [nested-loops]

A logical structure used in computer programming where two or more repeating statements are placed in a "nested" form (i.e., one loop is situated within the body of another). The inner loop is repeated in full on every pass through the outer loop.

nested-loops
-2 votes
1 answer
67 views

How to Convert Nested for Loops with Multiple Internal Loops into map() Function? [closed]

I was trying to speed up some nested for loops with multiple internal loops in python 3.11: for item1 in iterable1: for item2 in interable2: if condition == true: expression1 ...
F-22 Destroyer's user avatar
0 votes
0 answers
17 views

Difference in Output Between Two Similar C++ Codes with Nested Loops and transform

I'm experiencing a strange issue with two similar pieces of C++ code that are supposed to perform the same task but yield different results. The problem is around the inner loop statement . While ...
AyushRaj's user avatar
-1 votes
0 answers
29 views

How do I loop through all possible attachment configurations of items with attachment sites?

I have a collection of items for which I need to loop through combinations. Each item has two types of sites: A sites and B sites. Different items can have different numbers of A and B sites. I am ...
Telemann314's user avatar
3 votes
1 answer
71 views

Remove In Nested Loops (Remove Inside Foreach) [closed]

These are my entities: public class Permissions { public string PermissionName { get; set; } public List<Controllers> controllers { get; set; } } public class Controllers { public ...
Yasim Yasin's user avatar
-3 votes
1 answer
79 views

How to Display All Repetitive Digits from a String ? in vb.Net

String = 24-06-1966 repetitive Nos to be displayed 6, 6, 6 Non-Repetitive Nos to be displayed 2, 4, 1, 9 Hello If someone can help me to get or displayed Repetitive digits from Numeric String ...
SsD's user avatar
  • 11
-1 votes
3 answers
113 views

Getting random symbols after trying to replace chars in C++

I'm trying to replace every letter in string to next letter (a -> b, c -> d, etc.). I get random symbols or XXXX after compiling and running the program. #include <iostream> #include <...
avent's user avatar
  • 29
0 votes
1 answer
136 views

Use vectorised functions instead of the loops

My function is such that it takes the minimum over the range of dataframe which keeps increasing in length and maximum over the dataframe which reduces in length with each iteration. The dataframe ...
driver's user avatar
  • 175
1 vote
1 answer
53 views

Store result from nested for loop with two factor variables

I'd like to generate some simple calculations for each combination of two factor variables and store the results in a data frame. Here are the data: df <- data.frame(SPECIES = as.factor(c(rep("...
payne's user avatar
  • 13
0 votes
4 answers
115 views

Why does this code write the answers more than once instead of just once?

I've just made a C program about finding perfect numbers. It is kinda working, but it writes out the answers more than once(and it writes 24 as well for some reason). I have very basic C knowledge, I ...
Bence Kostyál-Szilágyi's user avatar
0 votes
0 answers
12 views

Can't access object in nested loop (JS and three.js) [duplicate]

I have a question about JavaScript and Threejs. I made an object title_and_coord that stores sentences and their Vector3 coordinates (for wherever each sentence appears in my scene). I am trying to ...
Iti Gupta's user avatar
1 vote
2 answers
63 views

C language pattern with unexpected result

I am trying to create a program in C to draw this pattern : 1 1 2 1 3 1 1 2 2 2 3 2 1 3 2 3 3 3 1 4 2 4 3 4 1 5 2 5 3 5 I checked the answer from solutions. #include <stdio.h> int main () { ...
Fady Saad's user avatar
0 votes
1 answer
56 views

Parallel processing for nested loops isn't working correctly in R

I'm trying to run a nested loop using the parallel() and foreach() packages to increase speed, but I'm not having success. I have a dataframe where the first column is a categorical data and the ...
Rodrigo Nehara's user avatar
1 vote
1 answer
63 views

VBA nested if-do-while to sum values

What I'm attempting to do: Loop through 2 worksheets (same workbook), comparing 2 criteria (farm and batch). If criteria match, then sum the values in the 'No. of Samples" cells and paste to &...
Michaela Danielle's user avatar
0 votes
0 answers
55 views

Flatting out multiple nested dictionary into a dataframe for use in data modeling

I am slowly working through different python courses to teach myself Python. After taking courses for ~ a month I started to work on building a model using a data API feed from DataGolf. The data is ...
George Augustaitis's user avatar
0 votes
1 answer
51 views

Terraform Nested loop for.each example

I'm attempting to create nested loops to iterate over each environment (dev, qa, uat) and build target group attachments for the target IPs associated with each environment. Here's what I have so far: ...
Jaimin Patel's user avatar

15 30 50 per page
1
2 3 4 5
330