nested-loops Questions
3
Solved
I'm new to python programming.
I have tried a lot to avoid these nested for loops, but no success.
My data input like:
[
{
"province_id": "1",
"name": "HCM&quo...
Polyphone asked 30/12, 2020 at 3:56
12
Solved
I have a problem that is really kind of a general programming question, but my implementation is in Java, so I will provide my examples that way
I have a class like this:
public class Foo {
Linked...
Raft asked 6/3, 2012 at 20:43
3
I have a dataframe, based on the strings in a column named "originator" I would like to check if the string has a word that resides in another list. If the string has a word that resides ...
Musclebound asked 28/9, 2020 at 19:29
1
Solved
I am trying to create IAM binding for Bigquery dataset using the resource - google_bigquery_dataset_iam_binding. The requirement is I read the parameters in this resource (dataset_id, role, members...
Incised asked 20/8, 2020 at 7:47
4
Solved
For a two-variable problem, outer is most likely the best solution for this and if the space to loop over is small enough then we can have expand.grid do our legwork. However, those are ruled out i...
Illegal asked 5/6, 2020 at 22:49
5
I'm practicing pointers and want to substitute pointer operations in place of the arrays to traverse through the elements of the array. I have read numerous articles and cannot grasp this concept. ...
Basie asked 30/9, 2014 at 16:32
5
Solved
Wrote this function in python that transposes a matrix:
def transpose(m):
height = len(m)
width = len(m[0])
return [ [ m[i][j] for i in range(0, height) ] for j in range(0, width) ]
In ...
Favela asked 9/6, 2013 at 5:8
6
Solved
I have 10 text files and I want to paste each file with its pair, such that I have 5 total files.
I tried the following:
for i in 4_1 5_1 6_1 7_1 8_1
do
for j in 4_2 5_2 6_2 7_2 8_2
do
past...
Supraorbital asked 25/2, 2015 at 17:12
12
Solved
I think this might be a pretty simple question, but I haven't been able to figure it out yet. If I've got a 2-dimensional array like so:
int[,] array = new int[2,3] { {1, 2, 3}, {4, 5, 6} };
Wha...
Compulsory asked 23/5, 2010 at 20:23
5
Solved
I am using itertools.product to find the possible weights an asset can take given that the sum of all weights adds up to 100.
min_wt = 10
max_wt = 50
step = 10
nb_Assets = 5
weight_mat = []
for ...
Antananarivo asked 12/11, 2019 at 17:10
2
Solved
How to I break an outer loop from within an nested structure that responds to the break statement in Swift?
For example:
while someCondition {
if someOtherCondition {
switch (someValue) {
case...
Raffin asked 5/6, 2014 at 0:9
4
Solved
I have a list of objects A. Each object A in this list contains list of object B and the object B contains list of Object C. The object C contains an attribute name that i want to use to filter usi...
Greenland asked 1/8, 2018 at 9:54
3
Solved
I have a list something like:
[[16777230, 0], [16777226, 1], [16777252, 2], [16777246, 0]]
I want to make a loop inside a loop(nested loop) for my operation in python such that the inner loop wi...
Schaffhausen asked 8/7, 2019 at 7:11
9
Solved
Edit: I'm sorry, but I forgot to mention that I'll need the values of the counter variables. So making one loop isn't a solution I'm afraid.
I'm not sure if this is possible at all, but I would li...
Intension asked 13/1, 2011 at 18:9
5
A friend of mine takes a sequence of numbers from 1 to n (where n > 0)
Within that sequence, he chooses two numbers, a and b
He says that the product of a and b should be equal to the sum of all n...
Republican asked 4/5, 2019 at 22:1
5
Solved
So far, if I have to loop through a multidimensional array, I use a foreach loop for each dimension.
e.g for two dimensions
foreach($array as $key=>$value)
{
foreach($value as $k2=>$v2)
{...
Warfourd asked 7/6, 2012 at 9:19
1
I have group tgt-cluster includes 3 hosts. I have written down role to deploy container which is executing on tgt-cluster group. I am controlling the number of containers to deploy with with_sequen...
Eliza asked 8/12, 2018 at 13:45
4
Solved
I have a List of objects of the following class:
public class Foo {
private Date date;
private String name;
private Long number;
}
This list is fetched from a database with order by date asc,...
Dashiell asked 2/11, 2018 at 12:42
10
Solved
How to have output :
ID: 0001
Name: Mike
Birthday: London 21/05/1989
Hobby: Reading
My below code is undefined, I want the array city + date to be together in the birthday.
My code was not, ch...
Unbowed asked 29/10, 2018 at 9:40
14
Solved
I tried this:
for(i = 0; i < 5; i++){
for(j = i + 1; j < 5; j++){
break(2);
}
alert(1);
}
only to get:
SyntaxError: missing ; before statement
So, how would I break a nested...
Crymotherapy asked 14/10, 2009 at 7:42
2
Solved
Let's say i have 2 classes.
Course Class
public class Course {
private int id;
private String name;
}
Student Class
public class Student {
private int id;
private String name;
private Lis...
Freddyfredek asked 30/4, 2018 at 7:56
4
Solved
I am trying to find the formula to count every iteration of this double for loop (in python for instance):
for i in range(5):
for j in range(5):
count = MYSTERIOUS_FORMULA
print count
Here th...
Cleanser asked 27/4, 2017 at 14:32
2
Solved
I have tried the code below: the purpose is to generate a dictionary where each key has a list as a value. The first iteration goes well and generates the item as I want it, but the second loop, th...
Radon asked 10/3, 2018 at 23:58
7
Solved
Is there a way to create for-loops of a form
for(int i = 0; i < 9; ++i) {
for(int j = 0; j < 9; ++i) {
//...
for(int k = 0; k < 9; ++k) { //N-th loop
without knowing N at the compile...
Mousetail asked 17/5, 2015 at 18:27
2
Solved
I have an object of objects that I am passing with vue and I am doing this to run:
<ul>
<li v-for="subjects in questions">
<li v-for="question in subjects">
@{{ question }}
...
Bernita asked 13/10, 2016 at 19:57
© 2022 - 2025 — McMap. All rights reserved.