Category "loops"

How do I add a delay in a JavaScript loop?

I would like to add a delay/sleep inside a while loop: I tried it like this: alert('hi'); for(var start = 1; start < 10; start++) { setTimeout(function

Data structure for iterating between players

I am new to programming, so I started working on a small guessing game for n players In theory they are supposed to take turns trying to guess some String, I've

R : Loop to keep only one specific value

I have a dataset and I would like to keep the value in a column of this dataframe (test_masses) for the mass having the highest intensity for masses close to th

How do I shutil.move my file, post processing, in python based on filename?

My code- import pandas as pd import datetime as dt import os import shutil path = "C:/Users/rocky/Desktop/autotranscribe/python/Matching" destination_path =

Is there an easy way to zero time with each new condition in a pandas dataframe?

I have a big-ass time series data frame where one condition changes at variable intervals. I would like to zero the time with each new condition, so I converted

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