Category "loops"

Infinite loop in a C++ constructor [closed]

I've got this class in c++ and I'm having trouble with the second constructor: for some unknown reason, the IDE is acusing an infinite loop. I

Is it possible to create new linked list nodes inside a loop in goLang?

I need to create a nodes for a linked list and return the head inside a Function. Definition for each node: type ListNode struct { Val int Next *ListNo

Remove certain elements from an array that fit a condition in PHP?

So i have an a array of numbers: $arr = [53, 182, 435, 591, 637]; All i am trying to do is loop trough each element and when a certain condition is true it sho

save multi-outcomes-variables using iteration in matlab

I want to build a loop in Matlab where 'i' is the iteration variable and for each 'i' an n*n matrix will be the outcome. my question is how can I tell the progr

How to make link sharing in php

Videos come from a folder and are automatically displayed on my website. But I am having a problem at implementing share feature. All I want to do is when share

How can I iterate a for loop in Python in the increments of sum of another variable and iterator

I am trying to make a python program for "The Sieve Of Eratosthenes" but I am stuck at one place. The c program I wrote looks something like this : for (i = 2;

sum of a int in a list excluding the " " python

I have a list like this lst = [12, 0, 13, ' ', 8, ' ', 13, 4, 4, 3, ' ', 0, ' ', 19, 0, 23, 8, ' ', 20, 15, ' ', 19, 14, ' ', 20, 1, 20, 3] and what I am looki

Adding new column with first non Nan for each row closest to a chosen column from a dataset Python

Hello I want to create a new column from a given dataset (that I call here "df") with the first non-Nan for each row and closest from a given column For example

Binding keyboard.on_press_key inside a For Loop in Python

I'd like to set up on_press_key binds using Python's Keyboard module through a For loop that's iteration through dictionary items. However, the binds do not see

Adding HTML in a if-statement

I want the html to open when the password is right and I have tried .js, document.write, .html, href, div, document.getElementById and nothing is working when i

Assigning each excel sheet to a variable while looping (using openpyxl) and create dataframe of each sheets

I have an excel document with multiple sheets containing different data sets. For instance, first sheet has 2 column data where as the second sheet (sheet 2) ha

Updating 2D array in python [duplicate]

size = 10 table = [[0] * size] * size for iter in range(size): table[iter][iter] = 9 for iter in range(size):

Call function at end of for loop is not working as intended

The following code is not working as intended when I call the next() function at end of for loop. For some reason only one item from the list is printed and it

Compute a function whose arguments stored in rows of a data frame in R

I have a very long function whose arguments take in different threshold values for different variables and give an event study result at the end. I want to comp

Capitalize specific indices of string using awk or python

I have an input file where each line contains 99 lowercase letters, bccdddcdccddddddabcdabcabdbacbdcaaccbbcabacbccabcacbcdcccbdbacdcbbcbcbcccacadaaccababadbcbaa

Avoiding a Loop to Extract Vectors From Rows in Dataframe in R

I have data in a text file in which the cases are stacked in a single column. I need to extract selected lines from each case into vectors. I know how to do t

How can i make for loop a recursive method

How can I make this code a recursive method? for (int i = 3; i < arr.length; i++) { writer.write(arr[i] + "\n"); strout += arr[i] + "\n"; }

Randomise each element of String from inside? [duplicate]

I am trying to change the place of characters in a string. The first and last have to stay like they are. For example: String str = "String te

For Looping data in html and SketchUp

I have an array of data in SketchUp which I need to present to html in a table format. I have an example of my code which I have hard-coded. ID = [["Harry", "22

How to delete certain number from a list in list using the index in python?

I have a list in a list, and I am trying to delete the third number of each sublist, but every time I am getting an error TypeError: list indices must be intege